drag drop from linux to a wxpython application

simo simoninusa2001 at yahoo.co.uk
Wed May 19 13:35:50 EDT 2004


marco <manatlan at online.fr> wrote in message news:<40ab3ae7$0$21248$636a15ce at news.free.fr>...
> I've got a wxpython application
> and when i drag'n' drop files from(linux) rox/nautilus/konqueror to my app
> i've got strange chars in filenames (on win32 : it works well)
> 
> example:
> - my dir "my photos" will become "/home/marc/my%20photos"
> - a dir "fêtes à strass" will become (something like this) 
> "/home/marc/f%A8%CFtes%20%8F%AC%20strass"

This is URL encoding. Basically because the use of top-bit-set
characters and spaces in filenames is evil. Don't forget that most
file managers are basically web browsers....

You'd need to URL decode the chars to get your original filename as on
Windows, try:

import urllib
print urllib.unquote_plus("f%A8%CFtes%20%8F%AC%20strass")

That will fix your %xx characters, although I don't get the same
encoding as you're getting there (maybe it's a unicode thing?):

print urllib.quote("fêtes à strass")
f%EAtes%20%E0%20strass



More information about the Python-list mailing list