[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs fails to use default locale

From: Ken Brown
Subject: Re: Emacs fails to use default locale
Date: Fri, 27 Nov 2009 13:06:57 -0500
User-agent: Thunderbird (Windows/20090812)

On 11/27/2009 10:49 AM, Jan Djärv wrote:
Ken Brown skrev:
According to


if LC_ALL, LC_CTYPE, and LANG are all either unset or empty, then the implementation-dependent default locale is supposed to be used. My understanding is that this should be done by using setlocale(LC_CTYPE, ""). But emacs's locale initialization seems to just use the environment variables, so it doesn't pick up the default locale if the variables are unset.

setlocale(LC_ALL, "") is the way. Emacs does that if LC_ALL is unset or not "C".

However, because of internal reasons, Emacs also does:
  /* The Emacs Lisp reader needs LC_NUMERIC to be "C",
     so that numbers are read and printed properly for Emacs Lisp.  */
  setlocale (LC_NUMERIC, "C");

Can you describe in more detail the problem you are seeing? I.e. what output is wrong?

I'm working in Cygwin 1.7, which has recently adopted a default locale that uses UTF-8 encoding. If I start emacs with none of the locale variables set, emacs appears to assume an ASCII character set. (I don't see "U" in the mode line, for instance.) Moreover, C-h C returns the error message "Unknown button type `help-xref'".

When I referred to emacs's locale initialization in my original post, I was referring to the code in lisp/international/mule-cmds.el. I don't really understand how this interacts with the setlocale calls.

Here's one further bit of information: If I evaluate (getenv "LANG") in the scratch buffer, it returns nil (as expected), but then C-h C suddenly works. And it tells me that the default coding system is nil, so it clearly hasn't picked up the system default.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]