unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Sven Joachim <svenjoac@gmx.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Coding system and environment variables
Date: Wed, 20 Feb 2008 16:41:02 +0100	[thread overview]
Message-ID: <87hcg3r5yp.fsf@gmx.de> (raw)
In-Reply-To: 1203494405.25030.9.camel@gora.got.jeppesensystems.com

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 &auml; 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 &ouml;.
>
>     (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 &ouml; is shown instead of the
> &ouml; 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 &ouml;
>
> 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	other threads:[~2008-02-20 15:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-20  8:00 Coding system and environment variables Göran Uddeborg
2008-02-20 15:41 ` Sven Joachim [this message]
2008-02-21 10:10   ` Göran Uddeborg
2008-02-20 16:23 ` Piet van Oostrum
2008-02-21 10:14   ` Göran Uddeborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87hcg3r5yp.fsf@gmx.de \
    --to=svenjoac@gmx.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).