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: dnd of filenames with locale specific characters



It looks like a bug with dnd to me. I think Bob should file a bug report with Apple.

I did some tests with my app, see comments below. I will probably file a bug report myself one of these days...

On Jul 11, 2006, at 12:15 AM, Greg Guerin wrote:

Some Latin-alphabet characters with accents, such as o-acute, have TWO
possible encodings in UTF-16 (or in UTF-8, for that matter).  One is the
"composed accent" form.  For o-acute, that's code position U+00F3.  The
second form is "decomposed accent" form, which is the unadorned letter code
(U+006F) followed by the combining acute accent (U+0301).  All
combining-accent forms apply to the prior character, and they "stack", so
you can have multiple ones applied to a single base character.

Now, if you use Finder to drop files or folders on a Java app, the
handleOpenFile() method receives an ApplicationEvent with a filename. 

Dnd INTO java works without a hitch, and it is indeed decomposed accent form that's used. 
Please note that I'm dropping files into an open java application, so it's handled by
drop(DropTargetDropEvent dtde)

If you have evidence of decomposed accents not working in filenames, please
post the exact versions of Java and Mac OS X the problem appears in.

My application first creates a temporary file, then creates a Transferable:
files.add(tempFile);
Transferable t = new FileTransfer(files, photoId);
The temporary file does get created, I can see it and open it in Finder. So decomposed accents work when using files.

When dropped in Finder, however, an error results on the console:
java[1850] Couldn't convert path "/Users/sandboge/Pictures/pm/temp/a?a?o?.jpg" to an FSRef to put on the pasteboard.
That's it. No stacktrace, no exception.

I have no idea if there is an acceptable workaround. FSRef sounds like Cocoa, or at least not Java.
Maybe the path is converted to MacRoman at some stage, if so I don't see how to get around the problem.
If only dnd to the finder needs to be supported it might be possible to use ascii-filenames and set upp a
folder action to correct the filenames as files are dropped. But I wouldn't spend much time trying that, I
have a feeling that a lot of hardship lurks on that path.

/Pierre Sandboge


 _______________________________________________
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: dnd of filenames with locale specific characters (From: Greg Guerin <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.