That’s because QString
is using the UTF-16 encoding of Unicode, whereas Julia uses UTF-8. UTF-16 is two bytes for most characters, but for some characters it is 4 bytes; wrongly assuming it is 2 bytes for every character is a common source of subtle bugs. (A 16-bit QChar
is one “code unit” but is not one Unicode codepoint in general.)
You can convert a Julia string to native-endian UTF-16 using transcode(UInt16, somestring)