diff options
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" |