https://kotlinlang.org logo
Title
s

Smallville7123

04/19/2019, 9:00 AM
does multi-char unicode fit in a single Char
i

ilya.gorbunov

04/19/2019, 2:58 PM
Since chars in kotlin string are code units in UTF-16 encoding, there are some unicode characters that require two consecutive koltin.Char to be stored. These two chars are called a surrogate pair.
s

Smallville7123

04/19/2019, 3:29 PM
ok, how would i handle such
such that it is safe to print a single character of input text of X length without accidentally printing half a Unicode (possibly resulting in a corrupted character)
if that unicode character happens to be directly at the end of X length
such that if it where to be correctly printed a buffer overflow would need to have occured to read 1 character past the allowed X length
s

Smallville7123

04/19/2019, 3:57 PM
ok