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

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

Re: UTF-8 in path / filename


From: Peter Dyballa
Subject: Re: UTF-8 in path / filename
Date: Fri, 25 Aug 2006 14:08:11 +0200


Am 24.08.2006 um 15:59 schrieb Grégory SCHMITT:

Hi everyone,

I'm running emacs 21.4.1 using Linux (Fedora Core 5). When I try to open a file and the path name contains UTF-8 letters, emacs won't be able to find
the file.

I create a folder called "Grégory". I put any file in it (let's call it
"test") and if I, from a simple xterm, try to do "emacs Grégory/test",
emacs won't be able to open the file. However, it will be successful if I
manually visit using C-x C-f.

If I use any other editor (such as mcedit), it will open OK.

Any explanation ?


Yes: your terminal emulation/shell swallows/hides information.

On Mac OS X in Apple's Terminal (TERM is xterm-color) I can see UTF-8 filenames, for example äöüßÜÖÄ€. File name expansion/completion does *not* work on them (although RGB äöüæÆÜÖÄ.txt gets expanded to RGB a?^?o?^?u?^?æ?^?U?^?O?^?A?^?.txt). And of course it does not work to invoke GNU Emacs with this file name as argument (or 'built-in' vi, nano. It *works* though when I do that from the *shell* buffer in Unicode Emacs 23.0.0 or GNU Emacs 22.0.50 ... (although no file name completion and the latter showing the ¨ as empty boxes in the file name) If I for example paste a name with UTF-8 contents from ls output to pass it to vi (it gives the best complaints) I can see that the de-composed UTF-8 characters are strangely interpreted. An ä seems to vanish and become kind of control character, the ¨ component of A¨, i.e. Ä, is passed as <cc> or such ...

Since in your case mcedit accepts the file name, mcedit and your terminal seem to use the same character encoding, so for both é *is* an é. GNU Emacs lives in its own world of almost indefinite character encodings. One way to make Emacs work correctly is to set environment variables like LC_All, LANG, or LC_CTYPE which obviously just repeat what your shell and your OS' standard utilities know. Next is *not* to set current-language-environment! From LC_CTYPE etc. Emacs learns what encodings to set for buffer contents, file names, process data. If it makes mistakes in this you might consider to use

        (prefer-coding-system           'iso-latin-9-unix)      ; the one with €

or a few such statements with different codings each. GNU Emacs will then try to apply these encodings first. Since you're working with a non-Unicode Emacs you might need to set

        (unify-8859-on-decoding-mode t)
        (unify-8859-on-encoding-mode t)

to make the 8 bit ISO Latin encodings be handled as quite the same, i.e. é would be in any of these encodings in which it exists the same, i.e. you could search for it in all buffers and you only once told isearch to look for é.


One important thing is that *you* already messed up your .emacs file. Try to launch it also with --no-init-file and/or --no-site-file and also with -nw, i.e. running inside the terminal without X windows.

--
Greetings

  Pete

The most exciting phrase to hear in science, the one that heralds new discoveries, is not "Eureka!" (I found it!) but "That's funny..."
                                      Isaac Asimov






reply via email to

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