Tuesday, November 29, 2011

Python utf-8 decoding problem

今天用Python/Google App Engine寫網站時遇到的error message:

File "C:\Python27\lib\encodings\utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa4 in position 57: invalid start byte

中文無法正常顯示,後來查到的解決方式是:把檔案編碼方式改成utf-8即可正常顯示。
reference: http://bbs.chinaunix.net/archiver/tid-2332880.html