Stefan Oltmann
12/10/2023, 3:14 PMmyByteArray.decodeToString()
decodes to an UTF-8 string, which is what I need most of the time. In some places I need a decodeToString() that does the same with ISO 8859-1.
How to achieve that?
myByteArray.map { it.toChar() }.joinToString("")
as ChatGPT suggests is wrong according to my unit tests.Sebastian Schuberth
12/10/2023, 3:18 PMString(myByteArray)
?Stefan Oltmann
12/10/2023, 3:21 PMString(myCharArray)
is the only available option.Jan Holešovský
12/10/2023, 8:01 PMdecodeToString()
you've mentioned converts from UTF-8 representation to a String (ie. to 16-bit unicode) - so do you actually want to convert from ByteArray that represents ISO8859-1 to a 'normal' String (16-bit unicode), or something else?
Maybe it might help to understand if you share your original code?Stefan Oltmann
12/10/2023, 8:07 PMStefan Oltmann
12/10/2023, 8:08 PMStefan Oltmann
12/10/2023, 8:09 PMStefan Oltmann
12/10/2023, 8:12 PMJan Holešovský
12/10/2023, 8:14 PMJan Holešovský
12/10/2023, 8:16 PMJan Holešovský
12/10/2023, 8:17 PMStefan Oltmann
12/10/2023, 8:18 PMJan Holešovský
12/10/2023, 8:18 PMStefan Oltmann
12/10/2023, 8:19 PMStefan Oltmann
12/10/2023, 8:21 PMJan Holešovský
12/10/2023, 8:22 PMJan Holešovský
12/10/2023, 8:29 PMStefan Oltmann
12/10/2023, 8:30 PM