"display charset" vs. Unix locales
Michael B Allen
mba2000 at ioplex.com
Sun Jun 1 04:30:18 GMT 2003
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. I should
have realized that your code depends on the locale samba is running
in which you are saying is the C locale? 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...
> > Actually it will probably say ISO-8859-1.
>
> If anything ever says that in the *C* locale, it's a bug.
In the C locale sure.
Mike
--
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