From 069753e9c2176abf09173ba5567db62837d8e681 Mon Sep 17 00:00:00 2001 From: Him188 Date: Thu, 2 Apr 2020 18:12:04 +0800 Subject: [PATCH] Make chinese letter length estimating more safer --- .../commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/type.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/type.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/type.kt index 40c2898da..d4b02b9e6 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/type.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/type.kt @@ -32,7 +32,7 @@ internal fun Int.toIpV4AddressString(): String { } internal fun String.chineseLength(upTo: Int): Int { - return this.sumUpTo(upTo) { if (it in '\u0391'..'\uFFE5') 3 else 1 } + return this.sumUpTo(upTo) { if (it in '\u0391'..'\uFFE5') 4 else 1 } } internal fun MessageChain.estimateLength(upTo: Int = Int.MAX_VALUE): Int =