diff options
author | Ned Deily <nad@acm.org> | 2011-01-24 21:46:44 (GMT) |
---|---|---|
committer | Ned Deily <nad@acm.org> | 2011-01-24 21:46:44 (GMT) |
commit | 122539e2870bcaf0ccd64bae0ade3cf4691f59da (patch) | |
tree | df3c151d8587b3856afb9a9a9f5b32c425927ce2 /Lib/idlelib/EditorWindow.py | |
parent | feac624827a6523e29f69210d69a0627d19bfd2b (diff) | |
download | cpython-122539e2870bcaf0ccd64bae0ade3cf4691f59da.zip cpython-122539e2870bcaf0ccd64bae0ade3cf4691f59da.tar.gz cpython-122539e2870bcaf0ccd64bae0ade3cf4691f59da.tar.bz2 |
#10974: IDLE no longer crashes if its recent files list includes files
with non-ASCII characters in their path names.
(with approval of release manager for 3.2rc2)
Diffstat (limited to 'Lib/idlelib/EditorWindow.py')
-rw-r--r-- | Lib/idlelib/EditorWindow.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index 7b7eb39..938a656 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -772,7 +772,8 @@ class EditorWindow(object): "Load and update the recent files list and menus" rf_list = [] if os.path.exists(self.recent_files_path): - rf_list_file = open(self.recent_files_path,'r') + rf_list_file = open(self.recent_files_path,'r', + encoding='utf_8', errors='replace') try: rf_list = rf_list_file.readlines() finally: @@ -790,7 +791,8 @@ class EditorWindow(object): rf_list = [path for path in rf_list if path not in bad_paths] ulchars = "1234567890ABCDEFGHIJK" rf_list = rf_list[0:len(ulchars)] - rf_file = open(self.recent_files_path, 'w') + rf_file = open(self.recent_files_path, 'w', + encoding='utf_8', errors='replace') try: rf_file.writelines(rf_list) finally: |