Exception has occurred: UnicodeDecodeError #3755
Replies: 1 comment
-
Eg. https://www.ietf.org/rfc/rfc4627.txt / https://datatracker.ietf.org/doc/html/rfc8259#section-8.1
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Exception has occurred: UnicodeDecodeError
'utf-8' codec can't decode byte 0xc9 in position 3237: invalid continuation byte
This exception is raised when calling
r.json()on a Response where ther.encodingisiso-8859-1.In
_models.py, the Responseclass'jsonmethod returnsjsonlib.loads(self.content, **kwargs)`.However, the Python documentation tells us that when bytes are used as an argument,
the input encoding should be UTF-8, UTF-16 or UTF-32.Returning
jsonlib.loads(self.text, **kwargs)fixes this Exception.Potentially, the best solution is to use a conditional return, e.g.
Beta Was this translation helpful? Give feedback.
All reactions