"display charset" vs. Unix locales

Steve Langasek vorlon at netexpress.net
Sun Jun 1 17:20:22 GMT 2003

On Sun, Jun 01, 2003 at 12:30:18AM -0400, Michael B Allen wrote:
> On Sat, 31 May 2003, Steve Langasek wrote:
> > > > One curious side-effect is that the default for display charset is
> > > > "ASCII", but glibc's nl_langinfo() returns "ANSI_X3.4-1968" as the
> > > > character set for the C locale.  This results in C locale conversions
> > 
> > > This is because you must first initialize the locale with
> > > setlocale(LC_CTYPE, ""). Then it will say ASCII.
> > 
> > See the patch. Glibc does *not* use the name "ASCII" for this character
> > set -- this is known.  The side-effect is that changing the name of the
> > character set results in different handling by Samba, which recognizes
> > "ASCII" as a special name and processes it internally.

> If the locale specified in the environment is used and you set it with
> setlocale(LC_CTYPE, "") it is conceivable that nl_langinfo will return
> "ASCII". I still have a Redhat 5.2 system that does this.

Really?  I guess glibc has changed a bit over the years. :)  On my glibc
2.3-based systems, there are no locales that return "ASCII" as the
canonical character set name.

> I should have realized that your code depends on the locale samba is
> running in which you are saying is the C locale?

Tested in several locales (ASCII, ISO8859-1, UTF8), for completeness.

> In this case it will return "ANSI_X3.4-1968". I don't know a lot about
> samba so I didn't think looking at your patch would help. I just
> thought you were trying to get from "ANSI_X3.4-1968" to "ASCII" and I
> knew how to do that...

But really, the only way to get from the one to the other in this case
is if Samba knows about both names.

Steve Langasek
postmodern programmer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20030601/68afd77d/attachment.bin

More information about the samba-technical mailing list