[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to <undefined>

On Thu, May 24, 2018 at 6:48 AM, Dan Stromberg <drsalists at gmail.com> wrote:
> On Sat, May 19, 2018 at 3:58 PM,  <bellcanadardp at gmail.com> wrote:
>> On Thursday, 29 January 2009 12:09:29 UTC-5, Anjanesh Lekshminarayanan  wrote:
>>> > It does auto-detect it as cp1252- look at the files in the traceback and
>>> > you'll see lib\encodings\cp1252.py. Since cp1252 seems to be the wrong
>>> > encoding, try opening it as utf-8 or latin1 and see if that fixes it.
>>> Thanks a lot ! utf-8 and latin1 were accepted !
>> hello i am having same issue..i believe the code is written in python 2 and i am running python 3.6..i tried at the interpreter..f =
>> open(filename, encoding="utf-8" and also latin-1..but then when i run my file i still get the error...also my line is at 7414..how do you find this line??...is it better to try to run the file .py in python 2??..thnxz
> As suggested by others, if this is a text file, request the encoding
> from the person who created it.  chardet can't really autodetect all
> encodings, and neither can guessing encodings in a more manual way -
> though if there's no one to ask, sometimes chardet is better than not
> reading the file :)

Yep. And if chardet says it's MacCyrillic, it's probably actually
Codepage 1256 - that's been my experience.