"display charset" vs. Unix locales

Michael B Allen mba2000 at ioplex.com
Sun Jun 1 19:24:00 GMT 2003

On Sun, 1 Jun 2003, Steve Langasek wrote:
> > > > 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.

Actually IIRC Redhat 5.2 doesn't technicaly use "glibc". It used
"libc-5.x". I didn't even use locale files (see NOTES in setlocate(3)). So
nl_langinfo probably doesn't return ASCII anymore but at one time it did.

> > 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.

Good. You have me worried there for a minute :-)


A  program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes  the  potential  for it to be applied to tasks that are
conceptually  similar and, more important, to tasks that have not
yet been conceived. 

More information about the samba-technical mailing list