osdir.com


[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 Sun, 03 Jun 2018 16:36:12 -0700, bellcanadardp wrote:

> hello peter ...how exactly would i solve this issue .....i have a script
> that works in python 2 but not pytho3..i did 2 to 3.py ...but i still
> get the errro...character undefieed..unicode decode error cant decode
> byte 1x09 in line 7414 from cp 1252..like would you have a sraright
> solution answer??..i cant get a straight answer..it was ported from ansi
> to python...so its utf-8 as far asi can see

You won't get a straight answer because you won't tell us *precisely* 
what is happening.

Don't retype a summary of what you think the error is. "character 
undefieed" is not a thing, and there is no such thing as "byte 1x09".

You need to COPY AND PASTE the EXACT error that you get. Not just the 
last line, the error message, but the FULL TRACEBACK starting from the 
line "Traceback" and going to the end.

Until you do that, we cannot give you a straight answer.

You also need to COPY AND PASTE the EXACT line of code that gives the 
error, plus enough code so that it works. For a file read error, that 
probably means code that opens the file, and then tries to read from it.

Until you do that, we cannot give you a straight answer.

You need to tell us what version of Python you are using, and the 
operating system.

You should read this:

http://sscce.org/

Even though it is written for Java programmers, it applies to Python to.

If you think that your file is UTF-8, why are you using CP-1252 to read 
the file?

https://en.wikipedia.org/wiki/Windows-1252

https://en.wikipedia.org/wiki/UTF-8



I recommend you start with reading this if you haven't already:

https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-
software-developer-absolutely-positively-must-know-about-unicode-and-
character-sets-no-excuses/

Sorry for the huge URL, try this if your mail client breaks it:

https://tinyurl.com/h8yg9d7


Until you read that, you will probably remain confused about text  
encodings and Unicode and will probably not understand the straight 
answer we give you.

Also read: https://nedbatchelder.com/text/unipain.html



-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson