UnicodeDecodeError: 'utf8' codec can't decode bytes in position 3-6: invalid data

后端 未结 8 1271
谎友^
谎友^ 2020-11-30 00:46

how does the unicode thing works on python2? i just dont get it.

here i download data from a server and parse it for JSON.

Traceback (most recent cal         


        
8条回答
  •  暖寄归人
    2020-11-30 01:38

    My solution is a bit funny.I never thought that would it be as easy as save as with UTF-8 codec.I'm using notepad++(v5.6.8).I didn't notice that I saved it with ANSI codec initially. I'm using separate file to place all localized dictionary. I found my solution under 'Encoding' tab from my Notepad++.I select 'Encoding in UTF-8 without BOM' and save it. It works brilliantly.

提交回复
热议问题