diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2005-11-27 16:59:04 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2005-11-27 16:59:04 (GMT) |
commit | 307021f40b227d2bf114b536c37cc41e03fc2aff (patch) | |
tree | 5a45b1fd79d1ea12c2822045fc58cacf77416b89 /Lib/idlelib/IOBinding.py | |
parent | 1f663574ee154dfc95b883747137040f51ea7ef6 (diff) | |
download | cpython-307021f40b227d2bf114b536c37cc41e03fc2aff.zip cpython-307021f40b227d2bf114b536c37cc41e03fc2aff.tar.gz cpython-307021f40b227d2bf114b536c37cc41e03fc2aff.tar.bz2 |
Patch #1162825: Support non-ASCII characters in IDLE window titles.
Diffstat (limited to 'Lib/idlelib/IOBinding.py')
-rw-r--r-- | Lib/idlelib/IOBinding.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py index 4d67292..ce1fd2a 100644 --- a/Lib/idlelib/IOBinding.py +++ b/Lib/idlelib/IOBinding.py @@ -32,6 +32,9 @@ try: except (ImportError, locale.Error): pass +# Encoding for file names +filesystemencoding = sys.getfilesystemencoding() + encoding = "ascii" if sys.platform == 'win32': # On Windows, we could use "mbcs". However, to give the user @@ -517,7 +520,10 @@ class IOBinding: if not self.opendialog: self.opendialog = tkFileDialog.Open(master=self.text, filetypes=self.filetypes) - return self.opendialog.show(initialdir=dir, initialfile=base) + filename = self.opendialog.show(initialdir=dir, initialfile=base) + if isinstance(filename, unicode): + filename = filename.encode(filesystemencoding) + return filename def defaultfilename(self, mode="open"): if self.filename: @@ -536,7 +542,10 @@ class IOBinding: if not self.savedialog: self.savedialog = tkFileDialog.SaveAs(master=self.text, filetypes=self.filetypes) - return self.savedialog.show(initialdir=dir, initialfile=base) + filename = self.savedialog.show(initialdir=dir, initialfile=base) + if isinstance(filename, unicode): + filename = filename.encode(filesystemencoding) + return filename def updaterecentfileslist(self,filename): "Update recent file list on all editor windows" |