Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

std::wstring

Status
Not open for further replies.

Lorey

Programmer
Feb 16, 2003
88
SG
hi experts,

i have a std::wstring variable and i want to loop thru it via iterator.

what is the byte size of each character in std::wstring?

 
I'm not too familiar with Unicode, but I'm guessing you'd need to get a library that converts between UTF16 & UTF32...

I know with UTF8 you can use English strings the same as ASCII strings, but once you get into languages like Chinese (which doesn't fit into 1 byte) it combines several bytes together for each character. I'm guessing the same kind of thing is true for UTF16 & UTF32 (i.e. English strings are the same as ASCII, except with 1 or 3 NUL characters padding, which you are just chopping off).
 
I know that my answer is too simple but I am just saying it.

Why don't you create your won procedure to convert using arrays, getting every single character from string and putting into array (where the size of array will be variable which you get from the system, like size of wchar,..., max length, and so on).

Once I did so and it works (at least in different windows platforms, I didn't use solaris till now).

Have fun!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top