Problem with tkFileDialog.askdirectory(), Windows,and non-ascii paths

R

Read Roberts

I have the current Windows binary install of Python 2.3.4 on my
Windows XP system.

I am pained to discover that tkFileDialog.askdirectory() returns a
mangled path when a directory is selected which has non-ascii Unicode
path, as in Kanji characters, i.e. the usull "????" in place of the
original UTF-8 code points. .

After some time spent Google'ing. I don't find a discussion of this.
Is there some option or configuration change I can make to fix this?
I can roll my own file-dialog , but I prefer to re-use code.
 
T

Tim Williams

Read Roberts said:
I have the current Windows binary install of Python 2.3.4 on my
Windows XP system.

I am pained to discover that tkFileDialog.askdirectory() returns a
mangled path when a directory is selected which has non-ascii Unicode
path, as in Kanji characters, i.e. the usull "????" in place of the
original UTF-8 code points. .

After some time spent Google'ing. I don't find a discussion of this.
Is there some option or configuration change I can make to fix this?
I can roll my own file-dialog , but I prefer to re-use code.

I had a problem with using tkFileDialog.filename between Windows and
Linux. The solution I got was to use unicode().

HTH
 
R

Read Roberts

Thank your for your response. I did see your
e-mail when googl'ing for similar issues.
However, the problem you had was that the the
object returned on cancelling is different
bertween Linux and Windows.

My problem is that when you do select a directory
with the tkFileDialog.askdirectory() , on
Windows the object returned is a byte string,
with the non-ascii characters converted to '?".
Applying the 'unicode" function to this cannot
restore the lost data.

The particular path i am struggling with a a
parent directory with the utf-8 name:
"\343\201\246\343\201\231\343\201\250\343\203\225\343\202\251\343\203\253\343\202\277\343\202\231"


- Read Roberts
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top