Re: wchar_t* turned into a char*?
Re: wchar_t* turned into a char*?
- Subject: Re: wchar_t* turned into a char*?
- From: "Glenn L. Austin" <email@hidden>
- Date: Tue, 27 Jul 2004 17:31:54 -0700
on 7/27/04 4:59 PM, Mark Morrill at email@hidden wrote:
> 三 0xe4 0xb8 0x89 -> 0x000000e4 0x000000b8 0x00000089
> 個 0xe5 0x80 0x8b -> 0x000000e5 0x00000080 0x0000008b
> 子 0xe5 0xad 0x90 -> 0x000000e5 0x000000ad 0x00000090
>
> This method of character encoding is quite unfamiliar to me. Is this
> what I should be expecting from gcc? This certainly doesn't seem like
> Unicode to me...
It's not, well not really.
Since you're using UTF-8-encoded strings, you should use char not wchar_t.
Wchar_t is really for encoding Unicode code points directly, not encoded
code points.
The great thing about UTF-8 is that, except for 0x0000, you can basically
use standard C string routines (char*) for transferring the Unicode strings
from place to place (and if you use std::string, then you can deal with
0x0000 as well). Just remember that you can't use standard routines to
truncate them -- either use a UTF-8-aware routine, or do all of your string
truncation with Unicode "strings."
--
Glenn L. Austin <><
Computer Wizard and Race Car Driver
<email@hidden>
<http://www.austin-home.com/glenn/>
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.