void String::copyFromUTF16(...) - Comments

Tsuda Kageyu tsuda.kageyu at gmail.com
Wed Jan 22 19:56:28 UTC 2014


Hi Festus.

I said:
>If you read a little-endian BOM as a 16-bit integer in a little-endian 
>system, it will be 0xfeff.
>
>That's what this line checks.
>> if(length >= 1 && s[0] == 0xfeff)

If s[0] == 0xfeff, it means you are reading a UTF-16LE string on a 
little-endian system or a UTF-16BE one on a big-endian system. The 
comment "Same as CPU endian. No need to swap bytes." describes that 
situation.
If the UTF-16 endian is different from the CPU endian, a BOM will look 
like swapped and s[0] will be 0xfffe. 

Kageyu.


More information about the taglib-devel mailing list