[OS X Emacs] M-x shell and file names with umlauts

Ian Eure ian at digg.com
Tue Oct 7 14:49:15 EDT 2008

On Oct 6, 2008, at 4:37 PM, David Reitter wrote:

> This discussion has cropped up back in 2005, and now again on  
> aquamacs-bugs.  Let's solve the mystery.
> File names don't appear to be decoded and shown correctly when I do  
> M-x shell and then "ls". Interestingly, "ls" just leads to file  
> names that are shown as "??"…"ls" must be guessing that the terminal  
> only processes ASCII.  This bit of communication would go via the  
> LANG environment variable, part of a system's locale.  If we try to  
> set it to something sensible involving UTF-8:
> export LANG=de_DE.UTF-8
> then, suddenly, "ls" does the right thing!  I'm not sure what the  
> correct setting for the language bit would be - en_US.UTF-8 works  
> just as well.
The format is:


e.g. en_US.UTF-8 is US English encoded in UTF-8.

> Now, the big question is, what is the right thing to do for Emacs on  
> the Mac?
> Shouldn't M-x shell set the locale to something sensible, at least  
> the LANG variable?  Shouldn't it set the process coding system to  
> UTF-8??
> I'd like to get these things right, and people with experience in  
> unix architectures may have answers here.
I don't know if Emacs even has the ability to set environment  
variables for inferior processes. I think this is the job of your  
shell or system init files. I'd suggest adding this to your ~/.profile:

eval `locale | sed 's/^/export /'`

Setting the coding-system for process I/O like you did (C-x RET p) is  
a part of setting your language environment. I'd suggest you set it to  
UTF-8, which can be accomplished by going to Options -> Language ->  
Set Language Environment -> UTF-8.

  - Ian

More information about the MacOSX-Emacs mailing list