* Emacs fails to use default locale
@ 2009-11-25 19:08 Ken Brown
2009-11-27 15:49 ` Jan Djärv
0 siblings, 1 reply; 4+ messages in thread
From: Ken Brown @ 2009-11-25 19:08 UTC (permalink / raw)
To: emacs-devel
According to
http://www.opengroup.org/onlinepubs/007908799/xbd/envvar.html
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.
Ken
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Emacs fails to use default locale
2009-11-25 19:08 Emacs fails to use default locale Ken Brown
@ 2009-11-27 15:49 ` Jan Djärv
2009-11-27 18:06 ` Ken Brown
0 siblings, 1 reply; 4+ messages in thread
From: Jan Djärv @ 2009-11-27 15:49 UTC (permalink / raw)
To: Ken Brown; +Cc: emacs-devel
Ken Brown skrev:
> According to
>
> http://www.opengroup.org/onlinepubs/007908799/xbd/envvar.html
>
> 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?
Jan D.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Emacs fails to use default locale
2009-11-27 15:49 ` Jan Djärv
@ 2009-11-27 18:06 ` Ken Brown
2009-11-28 15:20 ` Ken Brown
0 siblings, 1 reply; 4+ messages in thread
From: Ken Brown @ 2009-11-27 18:06 UTC (permalink / raw)
To: Jan Djärv; +Cc: emacs-devel
On 11/27/2009 10:49 AM, Jan Djärv wrote:
> Ken Brown skrev:
>> According to
>>
>> http://www.opengroup.org/onlinepubs/007908799/xbd/envvar.html
>>
>> 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.
Ken
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Emacs fails to use default locale
2009-11-27 18:06 ` Ken Brown
@ 2009-11-28 15:20 ` Ken Brown
0 siblings, 0 replies; 4+ messages in thread
From: Ken Brown @ 2009-11-28 15:20 UTC (permalink / raw)
To: Jan Djärv; +Cc: emacs-devel
On 11/27/2009 1:06 PM, Ken Brown wrote:
> On 11/27/2009 10:49 AM, Jan Djärv wrote:
>> Ken Brown skrev:
>>> According to
>>>
>>> http://www.opengroup.org/onlinepubs/007908799/xbd/envvar.html
>>>
>>> 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.
Maybe the problem (or at least part of the problem) is that mule-cmds.el
doesn't call (locale-info 'codeset) when the CODESET can't be determined
from environment variables.
Ken
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-11-28 15:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-25 19:08 Emacs fails to use default locale Ken Brown
2009-11-27 15:49 ` Jan Djärv
2009-11-27 18:06 ` Ken Brown
2009-11-28 15:20 ` Ken Brown
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).