kotlinx-io
kotlinx-io copied to clipboard
CharsetNativeKt.platformUtf16 inaccessible outside main thread on native
platformUtf16 is only accessible on the main thread because it is not marked as @SharedImmutable. That breaks String.toByteArray().
This also breaks Ktor HttpClient on non-main threads (TextContent.bytes).
https://github.com/Kotlin/kotlinx-io/blob/44f0ebbf1026bb731ffb506c857aff5864e5343a/core/nativeMain/src/kotlinx/io/charsets/CharsetNative.kt#L192