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?
: .
, , , . c?rrupted "o" "?", , , .
c?rrupted
. yen, ? -1, 0xA5. ; v, ¥, ¸, Ë, Í, Ñ, Ą, ą, ċ, Ĩ, Ľ, ź, Β, Ξ, ξ, Ѕ, , , Ґ, Ҙ, ح,%, 4, ฅ, ", •, ₯, ╔, أ .
, , , / ; , .
, , .
:
json.loads(contents,encoding='latin1')
, .
Source: https://habr.com/ru/post/1541378/More articles:Read a file in python with a 0xc0 bug that causes utf-8 and ascii errors - pythonhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1541373/separate-development-and-deployment-git-repositories&usg=ALkJrhiZKtPqIL7P6kwE4tVc-HZKGjj-xAWhere is cache cache stored? - rHazelcast is inactive! in 3.2.1 - javaFile cannot be opened because you do not have permission to view it - osx-mavericksMemcpy crashes only on iPhone 5s - iosBest practice saving temp files on tomcat? - javaSum each nth line in Matlab - vectorizationHow is a parrot different from Numba? Since I have not seen any improvements in some NumPy expressions - pythonДинамическое сопоставление для поля объекта, которое разворачивает родительский путь - elasticsearchAll Articles