New submission from mfmain:

C:\tmp>hexdump badtell.txt

    000000: 61 20 6B 0D 0A D2 BB B0-E3                       a k......

C:\tmp>type test.py

    with open(r'c:\tmp\badtell.txt', "r", encoding='gbk') as f:
        while True:
            pos = f.tell()
            line = f.readline();
            if not line: break
            print(line)

C:\tmp>python test.py

    a k
    
    Traceback (most recent call last):
      File "test.py", line 4, in <module>
        line = f.readline();
    UnicodeDecodeError: 'gbk' codec can't decode byte 0xd2 in position 0:  
incomplete multibyte sequence


When I remove f.tell() statement, it decoded successfully.
I tried python3.4/3.5 x64 on win7/win10, it is all the same.

----------
components: Unicode
messages: 265224
nosy: ezio.melotti, haypo, mfmain
priority: normal
severity: normal
status: open
title: file.tell affect decoding
versions: Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26990>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to