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: file to uri to file madness




On 24 Aug 2006, at 09:19, François-Paul Servant wrote:

As you say: "it makes no sense why 2 will work but 3 or
4 will not." Only now that I realize that we have in fact the same strange behaviour simply with :
(new File(dir,"<e acute><e acute>.html")).exists() and
(new File(dir,"<e acute><e acute><e acute>.html")).exists()

(first one returns true - I was wrong saying the contrary in my first message, sorry - and second false)

That's why I came to thinking that the problem is in fact in the way the OS handles "accent decomposition".

It definitely looks like it's accent decomposition. I tried this code:

            testFile("\u00e9.html");
            testFile("\u00e9\u00e9.html");
            testFile("\u00e9\u00e9\u00e9.html");

            

            String[] files = new File(".").list();
            for ( int i = 0; i < files.length; i++ ) {
                String s = files[i];
                if ( s.endsWith(".html") )
                    testFile( s );
            }

    

    static void testFile( String s ) {
        System.out.println( s +": " + new File( s ).exists() );
        for ( int j = 0; j < s.length(); j++ )
            System.out.print( (int)s.charAt(j)+" " );
        System.out.println();
    }

and got the output (characters mangled by the Xcode console):

\216.html: true
233 46 104 116 109 108
\216\216.html: true
233 233 46 104 116 109 108
\216\216\216.html: false
233 233 233 46 104 116 109 108
e.html: true
101 46 104 116 109 108
e?.html: true
101 769 46 104 116 109 108
e?e?.html: true
101 769 101 769 46 104 116 109 108
e?e?e?.html: true
101 769 101 769 101 769 46 104 116 109 108

The composed accents from the original strings sometimes work and sometimes not, but if you list the files in the folder the names have decomposed accents and they work OK.

Jerry

 _______________________________________________
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: 
 >Re: file to uri to file madness (From: François-Paul Servant <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.