GCC and Unicode (OT)

Martin von Loewis loewis at informatik.hu-berlin.de
Tue Jan 4 14:57:08 EST 2000


kc5tja at garnet.armored.net (Samuel A. Falvo II) writes:

> Does anyone know of any way to make GCC produce 16-bit characters when
> encoding a Unicode string?  That is, if I have:
> 
> 	wchar_t *myText = L"ABCD";
> 	
> I want myText to point to the following:
> 
> 	0x0041 0x0042 0x0043 0x0044
> 
> instead of:
> 
> 	0x00000041 0x00000042 0x00000043 0x00000044
> 
> I'm using GCC under the Linux operating system.

When generating code for wide-string literals, gcc uses the type
wchar_t. The size of this type is defined by the platform (and its
ABI). gcc on Windows (and AIX?) uses 16-bit wchar_t, gcc on Solaris
and Linux uses 32-bit wchar_t. There is no way to change this.

Please be aware that this has nothing to do with Unicode, on an
abstract level. It is a wide character string, and the encoding of it
is implementation-defined.

Regards,
Martin



More information about the Python-list mailing list