[issue28712] Non-Windows mappings for a couple of Windows code pages

Eryk Sun report at bugs.python.org
Wed Nov 16 15:38:18 EST 2016


Eryk Sun added the comment:

I don't think the 2nd tuple element is useful when decoding a single byte. It either works or it doesn't, such as failing for non-ASCII bytes with multibyte codepages such as 932 and 950. 

I'm attaching the output from the following, which you should be able to open in a spreadsheet:

    import codecs
    codepages = [424, 856, 857, 864, 869, 874, 932, 949, 950,
                 1250, 1251, 1252, 1253, 1254, 1255, 1257, 1258]
    for cp in codepages:
        table = []
        for i in range(256):
            try:
                c = codecs.code_page_decode(cp, bytes([i]), None, True)
                c = ascii(c[0])
            except Exception:
                c = None
            table.append(c)
        print(cp, *table, sep=',')

----------
Added file: http://bugs.python.org/file45510/codepage_table.csv

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28712>
_______________________________________


More information about the Python-bugs-list mailing list