This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gcc ignores locale (no UTF-8 source code supported)


> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]