Stefan Oltmann
07/28/2025, 11:32 AM<http://io.ktor.utils.io|io.ktor.utils.io>.core.String
constructor here?
I need to decode ASCII.Aleksei Tirman [JB]
07/28/2025, 12:16 PMCharsets.ISO_8859_1.newDecoder()
to decode a Source
into a string. Here is an example:
val bytes = ByteArray(1024) { 65 }
val buffer = Buffer()
buffer.write(bytes)
val string = Charsets.ISO_8859_1.newDecoder().decode(buffer)
Stefan Oltmann
07/28/2025, 12:17 PMAleksei Tirman [JB]
07/28/2025, 12:20 PMStefan Oltmann
07/28/2025, 12:20 PMprivate val decoder = Charsets.ISO_8859_1.newDecoder()
internal actual fun ByteArray.decodeLatin1BytesToString(): String {
val buffer = Buffer()
buffer.write(this)
return decoder.decode(buffer)
}
Aleksei Tirman [JB]
07/28/2025, 12:21 PMStefan Oltmann
07/28/2025, 12:21 PM