Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Force Unicode support in Terminl directory listings UNIX
OSX's Unicode support allows for various languages to be used in the system. The Finder is able to display international languages with no problems. However, viewing files with non-English filenames in the Terminal results in a bunch of ?'s as file names instead of the actual filename.

The fix is to run the ls -v instead of just ls command to "force unedited printing of non-graphic characters." Check the man page for ls for more information.
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[3,250 views]  

Force Unicode support in Terminl directory listings | 9 comments | Create New Account
Click here to return to the 'Force Unicode support in Terminl directory listings' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Don't Work
Authored by: lerkista on Oct 16, '02 10:36:41AM

I tried with a floder names Toñoáéíóú

and the -v only changes from:

Ton??oa??a??

to:

TonÌoaÌeÌiÌoÌuÌ

It stills don't show the characters



[ Reply to This | # ]
Don't Work
Authored by: ajmas on Oct 16, '02 11:05:32AM

I believe that you should configure the terminal to to display UTF, as the default encoding would have trouble displaying unicode. I am not in front of my Mac, so I can't tell you where in there preferences it is.



[ Reply to This | # ]
don't work with fink ls
Authored by: nick on Oct 16, '02 11:28:13AM

the tip works perfectly with the buildin ls-command and german umlauts for me.

however, with the ls-command from the fink fileutils-package, it doesn't.

personaly i prefer having fink-ls' color output to buildin ls' unicode.



[ Reply to This | # ]
Yes, but...
Authored by: Worboren on Oct 16, '02 10:59:02AM
Nice tip, the Terminal displayed Option-8's perfectly for me. But the question still is, how do you actually enter those characters, that is, how do you tell cd what ls -v shows you?

[ Reply to This | # ]
Yes, but...
Authored by: Auricchio on Oct 16, '02 01:31:42PM
If I have a directory with special characters, e.g.

•downloads

I just do this:

% cd *loads

The leading bullet is used to prevent Retrospect from backing up the folder.

[ Reply to This | # ]
re: Yes, but...
Authored by: huzzam on Oct 16, '02 04:15:34PM
problem is if you have two similarly named files. Just last night, i ended up with two directories, one ending in ç, one ending in č (that's c with a hacek). (This is due to itunes's "Keep music folder organized" along with Serbian band names.) Otherwise the names were the same. Tab-completion didn't help, couldn't type EITHER one (can't even type a ç??? that's in iso-latin-1, isn't it?), couldn't even copy/paste it. I had to go to the finder & rename one of them before i could even cd into either one.

Quite an annoying speed bump. You'd think if the Terminal could display something, you'd be able to type it, or at least copy & paste it.

peter

[ Reply to This | # ]

re: Yes, but...
Authored by: pascalpp on Oct 17, '02 01:24:55AM

oddly enough, if i changed the character set encoding (File > Show Info > Display) to Western (Mac OS Roman) I was able to type an option-8 bullet, whereas in Unicode option-8 would produce the strange question mark symbols. Western encoding wouldn't let me type ç or é or any of those character variations though, whereas Unicode will.



[ Reply to This | # ]
re: Yes, but...
Authored by: pzwack on Oct 17, '02 01:07:51PM

>two directories, one ending in ç, one ending in 

Yes, it's a pain, Still, I am able to type "cd " into Terminal, then drag directory names with UTF8 chars into Terminal.app window, and zsh would then go into that folder. Of course, I couldn't type that gibberish the hasek produces, but it magically worked for me.

It may very well be depending on the configuration of your command shell and how rigid it blocks non-ASCII-input.

zsh's builtin pwd also prints UTF8 as is without problems.



[ Reply to This | # ]
With Japanese it gets even stranger...
Authored by: arglborps on Oct 16, '02 09:28:54PM

I just ran a calendar app with a Japanese name. Then when running top in the Terminal the Japanese name was displayed properly.

I thought "wow, they fixed this in 10.2??" so I did a cd to /Applications/ listing the directory with an ls, hoping that the Kanji and Hiragana of the application's name would also be displayed properly, with no luck (just got an ?????).

So apparently Terminal.app is seriously broken. I can't see any reason why it should be able to support Unicode with process names, but not with filenames.



[ Reply to This | # ]