help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Coding system and environment variables


From: Sven Joachim
Subject: Re: Coding system and environment variables
Date: Wed, 20 Feb 2008 16:41:02 +0100
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.90 (gnu/linux)

On 2008-02-20 09:00 +0100, Göran Uddeborg wrote:

> How is the coding system decided when reading an environment variable?

Normally it should use your preferred choice.

> I'm running a system using UTF-8.  My locale is sv_SE.utf8.  And emacs
> uses UTF-8 as default most of the time.  When I open a new file for
> example.
>
> I do have issues with strings coming from environment variables though.
> I first discovered this in the vm mail system, since it misinterpreted
> the variable MAIL which has the value /var/spool/mail/göran.  (In case
> your mailer mangles it, the last file name component is "g ä r a
> n".)  But it also causes problems with functions relating to the home
> directory.  HOME is /home/göran (same last component as before).
>
> As an example, I start emacs in my home directory, and do a few
> experiments in the scratch buffer (which has a "u" for coding system in
> the mode line):
>
>     default-directory
>     "/home/göran/"
>
> Looks good.  I see my ö.
>
>     (expand-file-name "")
>     "/home/göran"
>
> Ok too.
>
>     (expand-file-name "~")
>     "/home/g\303\266ran"

Yeah, I can reproduce this.  There seems to be something fishy when
expand-file-name expands the tilde.  But I'm not familiar with the code.

> Here the octal codes for a UTF-8 encoded ö is shown instead of the
> ö itself.  Why is this different?  The source of ~ is the
> environment variable HOME.  But if I explicitly ask for that variable:
>
>     (getenv "HOME")
>     "/home/göran"

That's okay.

> Here I see the ö
>
> Let's have a bit more fun.  Here I try to expand a FILE with my own
> name:
>
>     (expand-file-name "göran")
>     "/home/göran/göran"
>
> Looks the way I would expect.  Now the same thing, explicitly saying to
> put it in the home directory:
>
>     (expand-file-name "~/göran")
>     "/home/g\xc3\xb6ran/göran"

Please file a bug with M-x report-emacs-bug, I think the issue should be
brought to the developers' attention.

Cheers,
       Sven


reply via email to

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