1.在settings里设置DEFAULT_CHARSET = UTF-8,必要是在py文件头加#coding=utf-8
2.在网页中添加<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />,最好使用DW来保存,否则可能不是以UTF-8的格式来保存的。
如果提示:
‘utf-8’ codec can’t decode byte 0xc0 in position 334: invalid start byte
那么用记事本打开文件,另存为UTF-8格式,而不是ansi格式.就OK了.
详细说明在这里:
https://blog.csdn.net/zhang103886108/article/details/46874735