Author rmalouf
Recipients ezio.melotti, rmalouf, vstinner
Date 2020-04-28.04:33:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1588048436.43.0.594940005352.issue40416@roundup.psfhosted.org>
In-reply-to
Content
Calling TextIOWrapper.tell() while reading the attached gb2312-encoded file like this:

with open('udhr-gb2312.txt', encoding='GB2312') as f: 
    while True: 
       line = f.readline() 
       t = f.tell()
       if not line: 
           break 

gives this result:

Traceback (most recent call last):
  File "test.py", line 4, in <module>
    t = f.tell()
UnicodeDecodeError: 'gb2312' codec can't decode byte 0xb5 in position 0: illegal multibyte sequence

The file seems to be well-formed and can be read without any problem.  It's only the call to tell() that raises an issue.
History
Date User Action Args
2020-04-28 04:33:56rmaloufsetrecipients: + rmalouf, vstinner, ezio.melotti
2020-04-28 04:33:56rmaloufsetmessageid: <1588048436.43.0.594940005352.issue40416@roundup.psfhosted.org>
2020-04-28 04:33:56rmalouflinkissue40416 messages
2020-04-28 04:33:56rmaloufcreate