How to decode ¥ in JSON

I use python to parse a JSON file, I know that because of this ¥,

that i got this error when i used json.loads

UnicodeDecodeError: 'utf8' codec can't decode byte 0xa5 in position 106:
invalid start byte

But how do I get around this? Should I decode and encode again?

¥ is a sign of Chinese currency, but I'm not sure which category of code it belongs to.

Thank!

update:

======================

I think that my question should be, if you see this character, how do you guess the encoding.

The answer to this question may be:

If you see ¥ then utf-8 will not work, try latin-1 instead. Is this understanding correct?

0
source share
2 answers

: .

, , , . c?rrupted "o" "?", , , .

. yen, ? -1, 0xA5. ; v, ¥, ¸, Ë, Í, Ñ, Ą, ą, ċ, Ĩ, Ľ, ź, Β, Ξ, ξ, Ѕ, , , Ґ, Ҙ, ح,%, 4, ฅ, ", •, ₯, ╔, أ .

, , , / ; , .

, , .

0

:

 json.loads(contents,encoding='latin1') 

, .

0

Source: https://habr.com/ru/post/1541378/


All Articles