Which way Kotlin-Native deals with Strings?
I mean, '65K chars will be enough for everyone' was a mistake, UTF-16 has surrogate pairs, and Java's 16-bit `char`s are not actually characters (graphemes), just UTF-16 words.
And I really like the way Rust deals with strings: 'UTF-8 everywhere' and 'grapheme cluster is a thing'.
Sorry if the answer is obvious, I've never read anything about KN.
d
Dominaezzz
10/23/2018, 7:58 PM
For things like this, the Native back-end would be pretty much the same as the JVM one. So UTF-16.
Strings on the JVM are UTF-8 based. Most Unix based systems (incl Linux) use UTF-8 as the default encoding. UTF-16 isn't backwards compatible with UTF-8.
o
olonho
10/24/2018, 5:45 AM
To provide APIs required by Kotlin stdlib with decent speed we internally use utf-16, interop works with utf-8
m
msink
10/24/2018, 5:48 AM
But length of String and String constant is 32 bit, AFAIK.