Eryk Sun added the comment:

The default encoding on your system is Windows codepage 1251. However, your 
file is encoded using UTF-8:

    >>> lines = open('ResourceStrings.rc', 'rb').read().splitlines()
    >>> print(*lines, sep='\n')
    b'\xef\xbb\xbf\xd0\x90 (cyrillic A)'
    b'\xd0\x98 (cyrillic I) <<< line read fails'
    b'\xd0\x91 (cyrillic B)'

It even has a UTF-8 BOM (i.e. b'\xef\xbb\xbf'). You need to pass the encoding 
to built-in open():

    >>> print(open('ResourceStrings.rc', encoding='utf-8').read())
    А (cyrillic A)
    И (cyrillic I) <<< line read fails
    Б (cyrillic B)

nosy: +eryksun
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

Python tracker <>
Python-bugs-list mailing list

Reply via email to