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

Festus Hagen festushagenlists at yahoo.com
Wed Jan 22 19:30:03 UTC 2014

Hi Kageyu

Thanks for your response, And thanks for confirming I do know how to read code and do have some understanding of Endianness.

However that was not the question, In short, the question was:
  Do the comments correctly describe what the code does?

The comments state:
  Same as CPU endian.
And that is totally a false comment from my read of the code.

Just trying to clarify.


fh : )_~

----- Original Message -----
From: Tsuda Kageyu <tsuda.kageyu at gmail.com>
To: Festus Hagen <festushagenlists at yahoo.com>; taglib-devel at kde.org
Sent: Tuesday, January 21, 2014 11:04 AM
Subject: Re: void String::copyFromUTF16(...) - Comments

Hi Festus.

As you know, UTF-16 strings can be encoded in either little-endian or 
big-endian form. Little-endian ones have a BOM like { 0xff, 0xfe } and 
big-endian ones have { 0xfe, 0xff }.

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)


More information about the taglib-devel mailing list