1
如果目錄具有非ASCII字符,我在使用tkFileDialog.askdirectory()
的Windows上遇到問題。tkFileDialog.askdirectory()損壞unicode目錄
下面是一個例子:
import tkFileDialog
# Open folder C:\notused\weekly\1\Music\巖崎 琢
# (But while the dialog is open, the dialog itself shows the name mangled
# as "C:\notused\weekly\1\Music\?? ?")
o_result = tkFileDialog.askdirectory()
# Return result is unicode, which is correct..
print type(o_result)
# ...but the result string has the non-English characters mangled.
print o_result
# And it's not just the display, they seem to be actually mangled.
print ord(o_result[-1])
# The ordinal value of the final character is the same as the question-mark
print ord('?')
我注意到,對話本身就說明之前,我曾經觸摸它(這告訴我,它不是一個處理錯誤在我的部分)的錯位字符串,但我不能找到任何更改的參數或設置以使askdirectory()
正確工作。
我錯過了什麼?
在快速測試過程中,它看起來並不像這樣工作,但稍後當我有更多時間時再試。 – neilr8133