Is there a reason that `String.encodeToByteArray()...
# multiplatform
c
Is there a reason that
String.encodeToByteArray()
doesn't allow for choosing the desired encoding? It uses UTF-8 but I need ASCII
e
if your string only contains ASCII characters then UTF-8 is compatible. if your string isn't ASCII then how are you expecting to encode it to ASCII?
c
You use some default value for the UTF-8 chars that aren't ASCII. I believe that's '?'.
d
There is
String.toByteArray
which takes an encoding. It looks like
encodeToByteArray()
just called
toByteArray(Charsets.UTF_8)
anyway.
e
only on JVM
d
Ah, didn't realize.
e
Charset and Locale only exists on JVM