Summarizing, there are the following patterns in the described printout behavior: Print cp1251_code( 'utf-8', errors= 'replace')īelow is the illustration of implementation some other test cases: The problem with replacement char leads to very unpredictable printout behavior in general.įor example, I want to printout decoded bytes with error replacement: cp1251_bytes = '\xe4\xe0' # 'да' in cp1251 print cp1251_code( 'utf-8', errors= 'replace') So, Sublime can printout the '�' character, but for some reason doesn't do it in the 1st case.Īnd the dependence of the output on the order of statements seems quite strange. In some cases I get a pretty confusing output for '\uFFFD' - the 'REPLACEMENT CHARACTER'.įor example: print u'\ufffd' # should be '�' - the 'REPLACEMENT CHARACTER' print u'\u0061' # should be 'a'Īfter inversion of the order: print u'\u0061' print u'\ufffd' I'm using Python 2.7 build on Sublime Text 3 and have an issue with printing out.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |