Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with umlauts in file names



At 5:01 PM +0200 10/28/05, Thomas Singer wrote:
More related looks Freek's answer with strange "accent encoding". Is there some code available which converts normal strings to accent encoded or visa versa?

Russ Trotter schrieb:
Yes as others have alluded, this is probably a Unicode encoding artifact.
Thomas Singer wrote:

I create a new file on Mac OS X 10.4.2 with umlauts, e.g.

 new File("/dir/testäöü.txt").createNewFile();

The umlauts map to following bytes: ä=0xE4, ö=0xF6, ü=0xFC.

Now I read the directory content with

 String[] fileNames = new File("/dir").list();

The curious thing is, that now the file name looks similar, but has a different byte representation: ä=0x61 0x308, ö=0x6F 0x308, ü=0x75 0x308.

Is this a bug in Mac OS X' file system or a bug in Mac OS X' Java implementation? Does someone knows, how to work around this problem (except not using file names with umlauts)? Thanks in advance.

IIRC, this is an HFS feature and Java bug w/r/t HFS.

HFS+, by specification, stores filenames in unicode with accented characters in their decomposed cannonical form.

Note that there are two encodings for ä: 0xE4 and 0x61,0x308 (a + umlaut) where 0x308 is a combining umlaut.

If you create a fimename using the single character form, the HFS file system represents it in cannonical form (by specification), which is what you get when you read it back.

(If the form were not specifed, file name comparison would hget "interesting")

Unfortunately, IIRC, Java doesn't give you any help here.

HTH,

-Steve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Problem with umlauts in file names (From: Thomas Singer <email@hidden>)
 >Re: Problem with umlauts in file names (From: Thomas Singer <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.