|
|
@ -31,17 +31,19 @@ public object ModifiedUtf8Charset : Charset("ModifiedUtf8", null) { |
|
|
|
return CoderResult.OVERFLOW |
|
|
|
return CoderResult.OVERFLOW |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (len == 1) { |
|
|
|
when (len) { |
|
|
|
output.put(char.toByte()) |
|
|
|
1 -> output.put(char.toByte()) |
|
|
|
} else if (len == 2) { |
|
|
|
2 -> { |
|
|
|
output.put((0xC0 or ((char.toInt() shr 6) and 0x1F)).toByte()) |
|
|
|
output.put((0xC0 or ((char.toInt() shr 6) and 0x1F)).toByte()) |
|
|
|
output.put((0x80 or (char.toInt() and 0x3F)).toByte()) |
|
|
|
output.put((0x80 or (char.toInt() and 0x3F)).toByte()) |
|
|
|
} else { |
|
|
|
} |
|
|
|
|
|
|
|
else -> { |
|
|
|
output.put((0xE0 or ((char.toInt() shr 12) and 0x1F)).toByte()) |
|
|
|
output.put((0xE0 or ((char.toInt() shr 12) and 0x1F)).toByte()) |
|
|
|
output.put((0x80 or ((char.toInt() shr 6) and 0x1F)).toByte()) |
|
|
|
output.put((0x80 or ((char.toInt() shr 6) and 0x1F)).toByte()) |
|
|
|
output.put((0x80 or (char.toInt() and 0x3F)).toByte()) |
|
|
|
output.put((0x80 or (char.toInt() and 0x3F)).toByte()) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return CoderResult.UNDERFLOW |
|
|
|
return CoderResult.UNDERFLOW |
|
|
|
} |
|
|
|
} |
|
|
|