PDA

View Full Version : Charset problem between console / Java / Finder


babas1
10-22-2006, 12:51 PM
Hi, help please.

I am french, I use the stressed letters to name my file. (sorry!)
In the Finder, I see the correct name "è.jpg".
Under the console, ls -al displays : "e??.jpg".
So I use a Java program to identify the charset use : it sounds to be eCC80.jpg (hex).. which is "e" followed by the accent only. Sounds good.
How this encoding is called ? It is HFS ?

Second question is with Java which is using UTF-8 natively, i test :
"è.jpg".equals(file.getName()) // where file is my file above.
It is always false, between Java tests C3A8 (è UTF representation) to eCC80...
Here is where I am stuck ... How can i run a correct test ?

Thank you

hayne
10-22-2006, 01:08 PM
By "console" I guess you mean a "Terminal" window.
It is somewhat involved to get Terminal to display accented characters properly. I haven't bothered to find out how. There might be a macosxhints article about this so be sure to search on the main macosxhints site.

I'm not sure what is happening with your Java program. (I generally avoid use of any non-standard characters in filenames)
You should try creating a file with that name in your Java program and see how it shows up in Finder.

I'm sure you will find some documentation on the character encoding used for OS X filenames if you search at developer.apple.com