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



Robert,

I'm thinking you need to use a UTF-8 String, something like

byte[] theBytes = fArray[i].getBytes();
String inUTF8 = new String(theBytes, "UTF8");

then list.add the inUTF8 String

I haven't compiled this and run it, but there's the general idea, the same thing I had to do for dnd with odd filenames

Ed

On Sun, 9 Jul 2006 23:33:54 -0600
 Robert Potterveld <email@hidden> wrote:
I've run into a peculiar problem with a Java swing app as a drag source and files with locale specific characters embedded as part of the absolute path or in the filename. For example if any part of the absolute path or the name of the file contains a character such as ó as in the filename abcódef.txt, the target of the drop such as Finder will not accept the drop. If I remove the ó from the filename, the drop is successful. If I drag the same file from one Finder to another Finder window while the filename contains the ó everything works correctly.

The DataFlavor.javaFileListFlavor is the only data transfer flavor supported in this code and the getTransferData() method confirms the file exists before adding it to the resulting list. At least from a jvm perspective the File instance is valid.

public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
List list = new ArrayList();
for (int i=0; i<fArray.length; i++) {
if (fArray[i].exists()) {
list.add(fArray[i]);
}
}
return list;
}


Dropping the file from the java swing app to different targets also exhibits the same failure.

Mac OS X version is 10.4.7. Java version is 1.5.0_06. Any suggestions on how to work around this problem?

Thanks,

Bob Potterveld



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