I'm having problems dealing with accented characters in file names in the Terminal. Consider the following:
$ touch leão.png $ ls > test.txt $ open -a TextWrangler test.txt
The accented characters in
test.txt are incorrect. Here are some possibly relevant facts:
- I'm using Terminal with the default settings; the character encoding is set to UTF-8 and "Set locale environment variables on startup" is checked.
the output of
localein the shell is:
LANG="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_CTYPE="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_ALL="en_US.UTF-8"
TextWrangler's default encoding is UTF-8; trying to reopen the file in any other encoding just makes matters worse.
- I'm running OS 10.6.8.
In response to the comments, here is some more information:
The output of
od -tx1 test.txtis:
0000000 6c 65 61 cc 83 6f 2e 70 6e 67 0a 74 65 73 74 2e 0000020 74 78 74 0a 0000024
- If I do
echo leão.png > test2.txtthe text shows correctly in TextWrangler
test.txtin TextEdit displays:
test.txtin jEdit displays:
test.txtin AlphaX displays:
emacsfrom within terminal displays:
I'd really like to be able to work with non-ASCII filenames from within the shell. How can I get this to work?