Make chinese letter length estimating more safer

This commit is contained in:
Him188 2020-04-02 18:12:04 +08:00
parent 7abfa5a0af
commit 069753e9c2

View File

@ -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 =