Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

utf8' codec can't decode byte 0xae in position

Tags:

python

json

I just found out that my json string contains some special characters such as Pandora®. And I get this error 'utf8' codec can't decode byte 0xae in position: invalid start byte when i use this:

json.loads(str_to_load)

i have tried this to fix the issue:

json.loads(unicode(str_to_load), "ISO-8859-1")

Apparently, this seems to not working either. How to fix this issue?

The json file is too big to upload here.

like image 747
Co Koder Avatar asked Aug 01 '26 19:08

Co Koder


1 Answers

You can specify the encoding in json.loads:

json.loads(str_to_load, encoding="ISO-8859-1")
like image 86
Simeon Visser Avatar answered Aug 04 '26 07:08

Simeon Visser



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!