CYGWIN=codepage? Or LC_CTYPE=foo?

Brian Dessent brian@dessent.net
Sun Apr 6 19:31:00 GMT 2008


Corinna Vinschen wrote:

> And while I already confused myself no end, here's another question.
> 
> Shouldn't the (default) setting of LANG, LC_CTYPE and friends be based
> on what the underlying OS is set to?  Microsoft maintains a table which
> defines the relationship between the locale identifier used internally
> (LCID), the "Culture name" (what's used by POSIX) and the attached
> codepage.  The list is here:
> 
> http://www.microsoft.com/globaldev/nlsweb/default.mspx
> 
> In theory we could fetch the current LCID and set $LANG and the
> internally used codepage according to the table.
> 
> Or, we check if LANG/LC_CTYPE is set and only set the codepage according
> to the setting of these variables.  Otherwise we just use the default
> ANSI codepage.

How about a standalone program that reads what the Windows locale is set
to and echos the equivalent setting for LANG to stdout.  That can be
added to the system /etc/profile such that LANG gets set at startup, and
the user can override it if desired in their own $HOME/.profile or
equivalent.  This lets us keep in sync with what the user has configured
Windows to, but it keeps the logic outside of the DLL such that it can
just use whatever LANG is set to.

Brian



More information about the Cygwin-developers mailing list