• Kirill Smelkov's avatar
    *.py: Open files in binary mode and decode to UTF-8 explicitly if needed · a5349f5d
    Kirill Smelkov authored
    On Windows in text mode files are opened with encoding=locale.getdefaultlocale()
    which is CP125X instead of UTF-8 even if $PYTHONIOENCODING=UTF-8. This
    way e.g. test_strings_print fail as:
    
        E           Failed: not equal:
        E           Expected:
        E               print(qq(b)): "привет αβγ b"
        E               print(qq(u)): "привет αβγ u"
        E           Got:
        E               print(qq(b)): "привет αβγ b"
        E               print(qq(u)): "привет αβγ u"
    
    where "Expected" was read from golang/testprog/golang_test_str.txt and
    decoded wrongly.
    
    -> Fix it by always opening files for reading in binary mode and
    utf8-decoding manually, if needed, everywhere.
    a5349f5d
setup.py 14.6 KB