Edoardo Luppi
11/06/2023, 9:52 AM.properties
files in ISO-8859-1.
Does Native offer something related to this charset or am I on my own?ephemient
11/06/2023, 4:31 PMEdoardo Luppi
11/06/2023, 4:32 PMephemient
11/06/2023, 4:54 PMString
is a read-only wrapper around CharArray
, for Java compatibility. a Char
is a UTF-16 unit.UTF-8
when converting between kotlin.String
and anything outside Kotlin, such as .toKString()
or .encodeToByteArray()
Edoardo Luppi
11/06/2023, 4:58 PMephemient
11/06/2023, 5:00 PMEdoardo Luppi
11/06/2023, 5:02 PMpublic val String.cstr: CValues<ByteVar>
get() = if (isEmpty()) EmptyCString else CString(encodeToUtf8(this))
public val String.wcstr: CValues<UShortVar>
get() = U16CString(this.toCharArray())
Only the cstr
performs a conversion.
And on the runtime the string is identified as UTF-16
const KChar* utf16 = CharArrayAddressOfElementAt(thiz, start);