mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Print encoded versions of the file names in test application. Fixes #496084
This commit is contained in:
parent
77902970c5
commit
85f98143b7
1 changed files with 16 additions and 2 deletions
|
@ -124,6 +124,20 @@ def askdirectory (**options):
|
|||
# test stuff
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Since the file name may contain non-ASCII characters, we need
|
||||
# to find an encoding that likely supports the file name, and
|
||||
# displays correctly on the terminal.
|
||||
|
||||
# Start off with UTF-8
|
||||
enc = "utf-8"
|
||||
|
||||
# See whether CODESET is defined
|
||||
try:
|
||||
import locale
|
||||
enc = locale.nl_langinfo(locale.CODESET)
|
||||
except (ImportError, AttributeError):
|
||||
pass
|
||||
|
||||
print "open", askopenfilename(filetypes=[("all filez", "*")]).encode(enc)
|
||||
print "saveas", asksaveasfilename().encode(enc)
|
||||
|
||||
print "open", askopenfilename(filetypes=[("all filez", "*")])
|
||||
print "saveas", asksaveasfilename()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue