473,394 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

drag drop from linux to a wxpython application

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"

it seems the filenames are "escaped" ... is there a way to got the good
filenames ? (i means it doesn't come from python, but perhaps it's an
encoding problems ?! i'd like to use a function like "unescape()" in
javascript, to clean them)
Jul 18 '05 #1
3 2068
marco wrote:
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"


use urllib.unquote:
import urllib
urllib.unquote ("/home/marc/my%20photos")

'/home/marc/my photos'

I guess that the result is a utf8 string which has to be translated to ASCII
Latin1 or UCS[24] to become a regular Python string. At least that would
explain why ê and à occupy two characters in the encoded form.

Daniel
Jul 18 '05 #2
marco <ma******@online.fr> wrote in message news:<40***********************@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
Jul 18 '05 #3
simo a écrit :
marco <ma******@online.fr> wrote in message news:<40***********************@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


thanks a lot ...
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dave | last post by:
I need to add the ability to drag from a Windows Form and drop into a non dotNet application. For example, having a generated image in my app that I wish to drag out into explorer as a friendly way...
2
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard ( I don't mean different formats): SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put...
3
by: Ajay Krishnan Thampi | last post by:
I have a slight problem implementing 'drag and drop' from a datagrid to a tree-view. I have pasted my code below. Someone please advice me on what to do...pretty blur right now. ==code== ...
2
by: Grey | last post by:
I need to design a workflow application with C#. I want to design an UI with some workflow components which they can be drag & drop anywhere in order to design the workflow for the application...
0
by: RHSFSS | last post by:
Hi, I have a Drag and Drop registration problem (See http://www.thescripts.com/forum/thread434707.html for similar problem post), can anyone out thereadvise on the best solution? I have a .NET 2.0 ...
2
by: praveen0437 | last post by:
hi is there is any IDE which provides drag &drop facility for designing wxpython
4
by: stef | last post by:
hello, I'm trying to move from Delphi to Python (move from MatLab to Python already succeeded, also thanks to this discussion group). From the discussions in this list about "the best" GUI for...
5
by: ndoe | last post by:
i need a source code in python for example to make application with drag and drop fiture,i can't understand learning from wxPython2.6 docs,Thank for help
1
by: Eric von Horst | last post by:
Hi, I need some advice on Drag&Drop. What I want to achieve is the following: - I have a window that is divided in two : on the left hand I have a wx.TreeCtlr and on the other hand a...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.