bash and the current locale implementation

Andy Koppe
Thu Oct 1 11:09:00 GMT 2009

2009/10/1 Corinna Vinschen:
> We have a problem with bash.
> I'm using tcsh as my default shell, so I didn't see this problem
> earlier.  When you enter `setenv LANG=foo' in tcsh, it changes its its
> own environment and calls setlocale (LC_ALL, "").  Everything's fine.
> Bash, OTOH, does not do anything of this.  Assuming you enter `export
> LANG=foo', bash will not at all change its own environment.

That's standard behaviour. The locale variables need to be set up
before bash is invoked, e.g. in cygwin.bat or in the Windows
environment (or in the mintty settings).

Someone who does need to change locale on the fly the can always
invoke a new shell: 'LANG=foo bash -l'. In the console, that would
actually change the console charset accordingly. In a terminal, they'd
have to adjust the terminal themselves.

> Does anybody have a nifty, easy to implement idea how to workaround this
> problem in bash?

Colour me dubious. If bash did change its locale setting, that still
wouldn't change the charset of the console or terminal it's running
in. And what about its line history? Would it need to recode it all?


More information about the Cygwin-developers mailing list