How to fix: “UnicodeDecodeError: 'ascii' codec can't decode byte”

前端 未结 19 1756
谎友^
谎友^ 2020-11-22 01:21
as3:~/ngokevin-site# nano content/blog/20140114_test-chinese.mkd
as3:~/ngokevin-site# wok
Traceback (most recent call last):
File \"/usr/local/bin/wok\", line 4, in
         


        
19条回答
  •  离开以前
    2020-11-22 02:09

    Encode converts a unicode object in to a string object. I think you are trying to encode a string object. first convert your result into unicode object and then encode that unicode object into 'utf-8'. for example

        result = yourFunction()
        result.decode().encode('utf-8')
    

提交回复
热议问题