https://kotlinlang.org logo
#announcements
Title
# announcements
a

Albert

06/20/2019, 6:31 AM
Why isn't it possible to pass a charset to
ByteArray.decodeToString
with kotlin 1.3.40?
s

serebit

06/20/2019, 6:34 AM
If charsets are JVM-only, then that's probably why. The new functions in kotlin 1.3.40 are platform-agnostic
a

Albert

06/20/2019, 6:35 AM
For JVM specifically I think this can lead to confusion as with encoding/decoding it will take the system default.
Naming it
ByteArray.decodeToUtf8String
is probably more clear for every platform
g

gildor

06/20/2019, 9:25 AM
Than it will not allow to evolve this API in future
If one day common will have support of different encodings it will be just added as param with default UTF8 value
also many existing Kotlin API already use UTF8 as default
i

ilya.gorbunov

06/20/2019, 11:59 AM
We plan to provide common
decodeToString
with
Charset
in kotlinx-io library
8 Views