wcin, wstring, and encoding
wcin, wstring, and encoding
- Subject: wcin, wstring, and encoding
- From: Todd Heberlein <email@hidden>
- Date: Sun, 09 Jan 2011 14:35:08 -0800
I have some code that basically looks like this:
wstring filename; getline(wcin, filename);
When running this from the Terminal application it looks like the characters encoded in filename are encoded in UTF-8 even though wchar_t is 4-bytes wide. For example, if I use the Character Viewer to enter ARABIC LETTER FARSI YEH (Unicode: 06CC, UTF8: D8 8C)
filename[0] = 0xD8 filename[1] = 0x8C
instead of being encoded as a single character
filename[0] = 0x06CC
In other words, the single unicode point is encoded as two wchar_t characters in the wstring filename.
Is there any rule (or even rule of thumb) that lets me know the character encoding of a wstring? And in particular, a wstring read in from a wistream?
Thanks,
Todd
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden