Commit 8509ebc8 authored by Martin v. Löwis's avatar Martin v. Löwis

Patch #539392: Invoke setlocale, try opening the file in demo mode.

parent 95de5c16
...@@ -130,14 +130,30 @@ if __name__ == "__main__": ...@@ -130,14 +130,30 @@ if __name__ == "__main__":
# Start off with UTF-8 # Start off with UTF-8
enc = "utf-8" enc = "utf-8"
import sys
# See whether CODESET is defined # See whether CODESET is defined
try: try:
import locale import locale
locale.setlocale(locale.LC_ALL,'')
enc = locale.nl_langinfo(locale.CODESET) enc = locale.nl_langinfo(locale.CODESET)
except (ImportError, AttributeError): except (ImportError, AttributeError):
pass pass
print "open", askopenfilename(filetypes=[("all files", "*")]).encode(enc) # dialog for openening files
print "saveas", asksaveasfilename().encode(enc)
openfilename=askopenfilename(filetypes=[("all files", "*")])
try:
fp=open(openfilename,"r")
fp.close()
except:
print "Could not open File: "
print sys.exc_info()[1]
print "open", openfilename.encode(enc)
# dialog for saving files
saveasfilename=asksaveasfilename()
print "saveas", saveasfilename.encode(enc)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment