Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

chinese draganddrop

1 view
Skip to first unread message

sav...@mozapps.org

unread,
Jan 1, 2009, 3:16:21 PM1/1/09
to communit...@lists.mozilla.org
I am doing drag and drop using nsDropAndDrag.
When a chinese character is dropped it is in utf8 format %xx%xx%xx,jng
the code look like this

var url = transferUtils.retrieveURLFromData(data,data,
data.flavour.contentType);
nsDragAndDrop.dragDropSecurity( event,session,url);

var p = parseUri(url)
var aFile = Cc[local].......
aFile.initWithPath(p.path);

-----------------------------------------------
var url looks like 是.png
file:///home/user/Desktop/%E6%98%AF.png

when initWithPath is invoked it can not find that file.

How do I convert utf8 => nsURI or something like that

shaun


Benjamin Smedberg

unread,
Jan 5, 2009, 9:27:29 AM1/5/09
to

I suggest using the mozilla.dev.extensions newsgroup for this question.

If you have a file URI, you can turn it into a local file easily:

var uri = parseUri(url);
var file = uri.QueryInterface(Ci.nsIFileURL).file;

See
http://mxr.mozilla.org/mozilla-central/source/netwerk/base/public/nsIFileURL.idl

--BDS


0 new messages