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 <rep...@bugs.python.org>
<http://bugs.python.org/issue28712>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to