1

This is a question in the continuation of this one: UTF8 filenames and shell utilities: the nightmare of utf-8 and filenames is….

How to avoid this confusion with most notably the ls command on filnames created in the following way:

$ echo $LANG
en_US.UTF-8
$ mkdir test
$ cd test
$ touch á
$ touch a´
$

The first file is created by typing alt ⌥+E, A, the second one by typing A, alt ⌥+shift ⇧+E

Within an xterm window I get:

$ ls -al
total 0
drwxr-xr-x  2 hal  admin   136 Nov 11 15:52 .
drwxr-x---  7 hal  admin  4386 Nov 11 14:25 ..
-rw-r--r--  1 hal  admin     0 Nov 11 15:52 a´
-rw-r--r--  1 hal  admin     0 Nov 11 15:48 a´
$

Which is wrong.

Within a Terminal window I get:

$ ls -al
total 0
drwxr-xr-x  2 hal  admin   136 Nov 11 15:52 .
drwxr-x---  7 hal  admin  4386 Nov 11 14:25 ..
-rw-r--r--  1 hal  admin     0 Nov 11 15:52 a´
-rw-r--r--  1 hal  admin     0 Nov 11 15:48 á
$

Which is right.

The result is the same whichever shell I use: bash or zsh.


What xterm or XQuartz setting will avoid these 2 filenames to falsely look the same?
This problem doesn't exist on Mavericks (MacOS X 10.9).

1

Okay, finally sorted with the help of this post:

In summary, go here:

Download the preference pane, and add this entry:

Key=LANG Value=en_GB.UTF-8

I had already added this to my .bashrc and my .profile with no result. But I think XQuartz doesn't launch within that environment, so it never sees it until it is too late.

1
  • First part of your proposal is not relevant. As you may have noticed from the output of the echo $LANG, I'm in a fully utf-8 mode up to the shell level.
    – dan
    Apr 11 '14 at 14:58
-1

I am having a similar issues (related to R documentation), which boil down to the same thing.

From an XQuartz window, if you right click (or CTRL r-click) to get to the VT fonts menu, then select UTF8-fonts and UTF8-encoding, this will probably fix your problem.

However, I have not yet found a way to configure these by default, although I have found this:

$ appres XTerm | grep UTF
*fontMenu*utf8-mode*Label:      UTF-8 Encoding
*fontMenu*utf8-fonts*Label:     UTF-8 Fonts
*fontMenu*utf8-title*Label:     UTF-8 Titles

I took a wild stab in the dark and added this to my .Xdefaults:

xterm*utf8-mode: 1
xterm*utf8-fonts: 1

Unsuprisingly this did not work, since these 2 resources don't exist. I'm still looking for a way to turn it on by default.

2
  • Okay, finally sorted with the help of this post:
    – Nathan
    Apr 9 '14 at 8:30
  • 1
    Since you don't really bring any sort of solution to the original problem, I'd suggest you to put this within comments: "Here is what I tested and failed" and not within an answer.
    – dan
    Apr 11 '14 at 16:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .