[issue23672] IDLE can crash if file name contains non-BMP Unicode characters
sanad
report at bugs.python.org
Sun Aug 2 09:53:20 CEST 2015
sanad added the comment:
On the lines of changes proposed by Terry and others in the comments, this is the patch I'm submitting.
The function _filename_to_unicode() plays the major part in the plot. The function can get two types of filename ,'str' and 'bytes'. When its str, all the astral chars(characters that are outside BMP ) are replaced by the '�'(diamond question mark) character by performing a regex substitution in the return statement.
If the received filename is in the form of b'..' (bytes) or any other encoding ,it is first decoded(as was earlier) into str and before returning, all the out of range Unicode characters are replaced by the '�'(diamond question mark) character .
The effect on behavior is : the
1.IDLE is able to display correctly,the filename in the title-bar and in the file open dialog.
2. Any file with name that have astral chars in them are easily imported without any crash.
This is my first patch,please review it ,if any errors found I will correct them and upload again :)
----------
keywords: +patch
nosy: +sanad
Added file: http://bugs.python.org/file40098/issue23672(updated third).patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23672>
_______________________________________
More information about the Python-bugs-list
mailing list