From 145093e2a6168416f023112365a3e63f7ce3d1a7 Mon Sep 17 00:00:00 2001 From: BartArys Date: Sat, 26 Sep 2020 15:06:21 +0200 Subject: [PATCH] Change default gateway charset to UTF-8 --- CHANGELOG.md | 1 + .../main/kotlin/com/gitlab/kordlib/gateway/DefaultGateway.kt | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0a2755c995..dbd0776badb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Fixes * Fixed an issue where `LiveMessage` would not filter its event flow. #70 +* Fixed an issue where emojis from events would be decoded incorrectly. # 0.6.4 diff --git a/gateway/src/main/kotlin/com/gitlab/kordlib/gateway/DefaultGateway.kt b/gateway/src/main/kotlin/com/gitlab/kordlib/gateway/DefaultGateway.kt index e6d828e72e6..5f3f958a18b 100644 --- a/gateway/src/main/kotlin/com/gitlab/kordlib/gateway/DefaultGateway.kt +++ b/gateway/src/main/kotlin/com/gitlab/kordlib/gateway/DefaultGateway.kt @@ -182,14 +182,14 @@ class DefaultGateway(private val data: DefaultGatewayData) : Gateway { } return outputStream.use { - outputStream.toString(Charset.defaultCharset().name()) + outputStream.toString(Charsets.UTF_8) } } private suspend fun read(frame: Frame) { val json = when { compression -> frame.deflateData() - else -> frame.data.toString(Charset.defaultCharset()) + else -> String(frame.data, Charsets.UTF_8) } try {