[openbeos] Re: BString

  • From: "Daniel Reinhold" <danielr@xxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Mon, 12 Nov 2001 02:38:28 CST

>Hmmm, if I'm right Unicode can have null bytes in some chars, so 
>strings should be terminated by a double '\0', shouldn't they ?
>my 0.02 Euros before going to bed,

well... depends on what you mean by "double". 

Unicode strings are composed of wide characters (type wchar_t) which 
are two bytes under most implementations (but this is not a requirement 
-- they could be 4 bytes or longer). So the ending null is still just 
"one" character (however many bytes that is).

For example sizeof(L"abc") =3D=3D 8. That's four characters, including the 
terminating null, each of which is two bytes wide (in BeOS Intel, 
wchar_t is a typedef for unsigned short).

Other related posts: