IronLanguages / main

Work for this repo has moved to https://github.com/IronLanguages/ironpython2
1.16k stars 347 forks source link

Error handler for non-builtin encodings are not being called #1639

Closed slozier closed 7 years ago

slozier commented 7 years ago

Here's the repro code:

def test_unicode_error():
    # test with a standard error handler
    res = u"\xac\u1234\u20ac\u8000".encode("rot_13", "backslashreplace")
    assert res == "\xac\\h1234\\h20np\\h8000"

    # test with a custom error handler
    from codecs import register_error
    def handler(ex):
        return (u"", ex.end)
    register_error("test_unicode_error", handler)
    res = u"\xac\u1234\u20ac\u8000".encode("rot_13", "test_unicode_error")
    assert res == "\xac"

test_unicode_error()
slide commented 7 years ago

This issue was moved to IronLanguages/ironpython2#16