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: third).patch

Python tracker <>
Python-bugs-list mailing list

Reply via email to