This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: gcc ignores locale (no UTF-8 source code supported)
- To: Markus dot Kuhn at cl dot cam dot ac dot uk
- Subject: Re: gcc ignores locale (no UTF-8 source code supported)
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Fri, 22 Sep 2000 21:34:27 +0200
- CC: libc-alpha at sources dot redhat dot com
- References: <E13cR34-0003K8-00@wisbech.cl.cam.ac.uk>
> It seems that gcc ignores the locale and does not use glibc's multi-byte
> decoding functions to read in wide-string literals. :-(
I believe that gcc rightfully ignores the locale. The C standard says
that input files are mapped to the source character set in an
implementation-defined way; nowhere it says that environment settings
of the user operating the compiler should be taken into account.
It would be wrong to take such settings into account: the results of
invoking the compiler would not be reproducable anymore, and it would
not be possible to mix header files that are written in different
encodings - who says that header files on a system have an encoding
that necessarily matches the environment settings of some user?
I believe that characters outside the basic character set (i.e. ASCII)
should not be used in portable software. For many applications, using
facilities like gettext(3) will be a solution, as it puts the strings
in other encodings out of the source code. If you absolutely have to
have non-ASCII characters in your source code, you should use
universal character names, i.e.
wprintf(L"Sch\u00f6ne Gr\u00FC\u00DFe!\n");
That is not supported by gcc, yet - but I'm certain it will, before
any other alternative mechanism is usable.
Regards,
Martin