Message319733
I am able to verify the newly added aliases using the below assert statement
assert codecs.encode('a', '874') == codecs.encode('a', 'cp874')
I am struck on the part where it could be patched in the search_function and I hope this is the approach @serhiy.storchaka was making. After the usual logic I am checking if the aliased_encoding is None and if the normalized_encoding is all digits then I am prepending 'cp' in front and calling search_function again so that cases like '936' first look at the table which has higher precedence and then for other cases even though an entry is not present it returns 'cpXXXX' encoder.
I have tested it by removing newly added '874' from aliases.py so that instead of an error 'cp874' is returned. Since in the next call the case of encoding being digits is not valid due to prepending 'cp' there will be no error due to infinite recursion for wrong ones.
Thanks |
|
Date |
User |
Action |
Args |
2018-06-16 12:01:24 | xtreak | set | recipients:
+ xtreak, ronaldoussoren, vstinner, ezio.melotti, steven.daprano, serhiy.storchaka, winvinc |
2018-06-16 12:01:24 | xtreak | set | messageid: <1529150484.86.0.56676864532.issue33865@psf.upfronthosting.co.za> |
2018-06-16 12:01:24 | xtreak | link | issue33865 messages |
2018-06-16 12:01:24 | xtreak | create | |
|