GNU bug report logs - #3221
23.0.93; ns cannot handle nonascii file names

Previous Next

Package: emacs;

Reported by: Leo <sdl.web <at> gmail.com>

Date: Tue, 5 May 2009 14:40:04 UTC

Severity: normal

Tags: unreproducible

Done: Alan Third <alan <at> idiocy.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 3221 in the body.
You can then email your comments to 3221 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3221; Package emacs. (Tue, 05 May 2009 14:40:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 05 May 2009 14:40:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.0.93; ns cannot handle nonascii file names
Date: Tue, 05 May 2009 15:36:30 +0100
This is the biggest bug in ns port of Emacs. It exposed itself
originally through emms but I have found an easy way to reproduce it.

1. move .emacs.d and .emacs to some other places so that no user
customisation is in effect.

2. start Emacs from Finder

3. M-! touch 求助.txt

No 求助.txt will be created instead, a file named .txt is created.

If you start Emacs from terminal by running for example:

  /Applications/Emacs.app/Contents/MacOS/Emacs

you won't see this bug.

The consequencies of this bug is that all packages that call external
programs won't be able to handle non ascii names. For example,

http://permalink.gmane.org/gmane.emacs.emms.user/1426


If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/Applications/Emacs.app/Contents/Resources/etc/DEBUG for instructions.


In GNU Emacs 23.0.93.1 (i386-apple-darwin9.6.0, NS apple-appkit-949.43)
 of 2009-05-03 on neutron.local
Windowing system distributor `Apple', version 10.3.949
configured using `configure  '--with-ns''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  paredit-mode: t
  dired-omit-mode: t
  recentf-mode: t
  icomplete-mode: t
  savehist-mode: t
  display-time-mode: t
  xterm-mouse-mode: t
  delete-selection-mode: t
  global-auto-revert-mode: t
  minibuffer-depth-indicate-mode: t
  show-paren-mode: t
  rcirc-track-minor-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x g m M-x r e p o r <tab> <return>

Recent messages:
Loading rcirc...done
Loading paren...done
Loading /Users/gtd/.emacs.d/custom...done
Ido mode enabled
Loading /Users/gtd/.emacs.d/etc/recentf...done
Cleaning up the recentf list...done (0 removed)
Loading /Users/gtd/.emacs.d/init.d/site.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Current frame maximised.
(Press m to repeat this command)




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3221; Package emacs. (Tue, 05 May 2009 21:10:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 05 May 2009 21:10:06 GMT) Full text and rfc822 format available.

Message #10 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: emacs-pretest-bug <at> gnu.org
Subject: Re: bug#3221: 23.0.93; ns cannot handle nonascii file names
Date: Tue, 05 May 2009 22:02:54 +0100
On 2009-05-05 15:36 +0100, Leo wrote:
> This is the biggest bug in ns port of Emacs. It exposed itself
> originally through emms but I have found an easy way to reproduce it.
>
> 1. move .emacs.d and .emacs to some other places so that no user
> customisation is in effect.
>
> 2. start Emacs from Finder
>
> 3. M-! touch 求助.txt
>
> No 求助.txt will be created instead, a file named .txt is created.
>
> If you start Emacs from terminal by running for example:
>
>   /Applications/Emacs.app/Contents/MacOS/Emacs
>
> you won't see this bug.
>
> The consequencies of this bug is that all packages that call external
> programs won't be able to handle non ascii names. For example,
>
> http://permalink.gmane.org/gmane.emacs.emms.user/1426

After some investigation with Ian's help, I have found a workaround by
setting the language environment to UTF-8.

The bug seems to be that Emacs.app is completely unaware of the language
setting of OS X.

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .: I use Emacs :.

               www.git-scm.com
    git - the one true version control system






Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3221; Package emacs. (Tue, 05 May 2009 21:10:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 05 May 2009 21:10:07 GMT) Full text and rfc822 format available.

bug reassigned from package `emacs' to `emacs,ns'. Request was from Glenn Morris <rgm+emacsbugs <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Wed, 17 Jun 2009 07:35:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, owner <at> emacsbugs.donarmstrong.com:
bug#3221; Package emacs,ns. (Thu, 23 Jul 2009 16:55:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to Adrian Robert <adrian.b.robert <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, owner <at> emacsbugs.donarmstrong.com. (Thu, 23 Jul 2009 16:55:07 GMT) Full text and rfc822 format available.

Message #22 received at 3221 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Adrian Robert <adrian.b.robert <at> gmail.com>
To: 3221 <at> debbugs.gnu.org
Cc: Leo <sdl.web <at> gmail.com>, Ian Eure <ian <at> digg.com>
Subject: Re: 23.0.93; ns cannot handle nonascii file names
Date: Thu, 23 Jul 2009 12:47:03 -0400
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3221

Hi,

> After some investigation with Ian's help, I have found a workaround by
> setting the language environment to UTF-8.
>
> The bug seems to be that Emacs.app is completely unaware of the  
> language
> setting of OS X.


I'd like to fix this.

Do you know why it works from terminal?  Is there some code in emacs  
that reads the LANG or some other env setting and sets something in  
emacs?  Where?  What is the command to set the language environment?

While the various methods on the net to set up ~/.MacOSX/ 
environment.plist might work, there ought to be some Cocoa way to  
detect language setting directly...





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, owner <at> emacsbugs.donarmstrong.com:
bug#3221; Package emacs,ns. (Thu, 23 Jul 2009 19:45:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, owner <at> emacsbugs.donarmstrong.com. (Thu, 23 Jul 2009 19:45:04 GMT) Full text and rfc822 format available.

Message #27 received at 3221 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: Adrian Robert <adrian.b.robert <at> gmail.com>
Cc: 3221 <at> debbugs.gnu.org, Ian Eure <ian <at> digg.com>
Subject: Re: bug#3221: 23.0.93; ns cannot handle nonascii file names
Date: Thu, 23 Jul 2009 20:40:32 +0100
On 2009-07-23 17:47 +0100, Adrian Robert wrote:
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3221
>
> Hi,
>
>> After some investigation with Ian's help, I have found a workaround by
>> setting the language environment to UTF-8.
>>
>> The bug seems to be that Emacs.app is completely unaware of the
>> language setting of OS X.
>
> I'd like to fix this.
>
> Do you know why it works from terminal? Is there some code in emacs
> that reads the LANG or some other env setting and sets something in
> emacs? Where? What is the command to set the language environment?

I don't know how internally this is done. Maybe Ian can comment on this.

The language was set through  + system preferences + International.
After the setting, run 'env' in Terminal.app and there's a line:

  LANG=en_GB.UTF-8

When starting Emacs from Terminal.app by running:

  /Applications/Emacs.app/Contents/MacOS/Emacs -q

It picks up that setting automatically i.e. if you check variables such
as default-file-name-coding-system, it says UTF-8.

But if you start Emacs from dock, it is something else.

> While the various methods on the net to set up ~/.MacOSX/
> environment.plist might work, there ought to be some Cocoa way to
> detect language setting directly...

It will be nice to have that. The current behaviour gave me a big shock
when I first used Emacs.app.

-- 
Leo's Emacs uptime: 43 days, 5 hours, 49 minutes, 1 second



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, owner <at> emacsbugs.donarmstrong.com:
bug#3221; Package emacs,ns. (Thu, 23 Jul 2009 23:00:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jason Rumney <jasonr <at> f2s.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, owner <at> emacsbugs.donarmstrong.com. (Thu, 23 Jul 2009 23:00:04 GMT) Full text and rfc822 format available.

Message #32 received at 3221 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Jason Rumney <jasonr <at> f2s.com>
To: Adrian Robert <adrian.b.robert <at> gmail.com>, 3221 <at> debbugs.gnu.org
Cc: Ian Eure <ian <at> digg.com>, Leo <sdl.web <at> gmail.com>
Subject: Re: bug#3221: 23.0.93; ns cannot handle nonascii file names
Date: Fri, 24 Jul 2009 06:52:01 +0800
Adrian Robert wrote:
> I'd like to fix this.
>
> Do you know why it works from terminal?  Is there some code in emacs 
> that reads the LANG or some other env setting and sets something in 
> emacs?  Where?  What is the command to set the language environment?

Yes, the command that does it is set-locale-environment in 
international/mule-cmds.el, called from command-line as part of the 
startup sequence.

>
> While the various methods on the net to set up 
> ~/.MacOSX/environment.plist might work, there ought to be some Cocoa 
> way to detect language setting directly...

Yes, the way we handle this on Windows is with a function that 
initializes certain environment variables from the system APIs if they 
are not explicitly set. See init_environment in w32.c, which is called 
from main in emacs.c.  You probably need to do something similar at 
least on Mac OSX, I'm not sure about GnuStep etc, as that is probably 
running on a platform that complies with Emacs's expectations about 
which environment variables are set.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3221; Package emacs. (Sat, 16 Jan 2016 17:07:02 GMT) Full text and rfc822 format available.

Message #35 received at 3221 <at> debbugs.gnu.org (full text, mbox):

From: Alan J Third <alan <at> idiocy.org>
To: Adrian Robert <adrian.b.robert <at> gmail.com>
Cc: Ian Eure <ian <at> digg.com>, Leo <sdl.web <at> gmail.com>, 3221 <at> debbugs.gnu.org
Subject: Re: bug#3221: 23.0.93; ns cannot handle nonascii file names
Date: Sat, 16 Jan 2016 17:06:17 +0000
Adrian Robert <adrian.b.robert <at> gmail.com> writes:

> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3221
>
> Hi,
>
>> After some investigation with Ian's help, I have found a workaround by
>> setting the language environment to UTF-8.
>>
>> The bug seems to be that Emacs.app is completely unaware of the
>> language
>> setting of OS X.
>
>
> I'd like to fix this.
>
> Do you know why it works from terminal?  Is there some code in emacs
> that reads the LANG or some other env setting and sets something in
> emacs?  Where?  What is the command to set the language environment?

OS X's terminal application sets the LANG environment variable, so when
Emacs is run from there it picks up LANG. When run from the GUI (dock,
or spotlight or whatever) OS X does *not* set the LANG variable, so
Emacs doesn't pick it up.

> While the various methods on the net to set up
> ~/.MacOSX/environment.plist might work, there ought to be some Cocoa
> way to detect language setting directly...

It looks like the right way to get the locale from OS X is something
like:

const char * locale = [[[NSLocale currentLocale] localeIdentifier] UTF8String];

HOWEVER, it appears the actual bug reported:

> 2. start Emacs from Finder
> 
> 3. M-! touch 求助.txt
> 
> No 求助.txt will be created instead, a file named .txt is created.

is fixed in emacs 25. Or, at least, I can't reproduce it.

Not having LANG set does break ispell checking with hunspell on OSX, for
me at least, so it would still be nice to have the locale stuff fixed.
Presumably there are other reasons for wanting Emacs to have the correct
locale, too.

Should that be a new bug report?
-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3221; Package emacs. (Sat, 16 Jan 2016 18:35:01 GMT) Full text and rfc822 format available.

Message #38 received at 3221 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alan J Third <alan <at> idiocy.org>
Cc: ian <at> digg.com, adrian.b.robert <at> gmail.com, sdl.web <at> gmail.com,
 3221 <at> debbugs.gnu.org
Subject: Re: bug#3221: 23.0.93; ns cannot handle nonascii file names
Date: Sat, 16 Jan 2016 20:34:14 +0200
> From: Alan J Third <alan <at> idiocy.org>
> Date: Sat, 16 Jan 2016 17:06:17 +0000
> Cc: Ian Eure <ian <at> digg.com>, Leo <sdl.web <at> gmail.com>, 3221 <at> debbugs.gnu.org
> 
> Not having LANG set does break ispell checking with hunspell on OSX, for
> me at least, so it would still be nice to have the locale stuff fixed.
> Presumably there are other reasons for wanting Emacs to have the correct
> locale, too.
> 
> Should that be a new bug report?

Are you saying that the NS build doesn't pick up the correct locale in
the session run from the GUI because it can only do so if LANG is set?
If so, yes, I think a separate bug report should be filed for that.
Having a correct value of the locale is very important for many things
in Emacs; spell-checking is just a tip of the iceberg.

Thanks.




Added tag(s) unreproducible. Request was from Alan J Third <alan <at> idiocy.org> to control <at> debbugs.gnu.org. (Sat, 16 Jan 2016 20:49:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 3221 <at> debbugs.gnu.org and Leo <sdl.web <at> gmail.com> Request was from Alan Third <alan <at> idiocy.org> to control <at> debbugs.gnu.org. (Mon, 01 Feb 2016 22:28:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 01 Mar 2016 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 111 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.