python 2.7 django1.6 ctype = ctype.encode(default_encoding) # omit in 3.x!

来源:互联网 发布:mac同时登陆多个qq 编辑:程序博客网 时间:2024/05/23 14:18

1.注释到 mimetypes.py 以下代码 (我使用的)

                try:
                    ctype = ctype.encode(default_encoding) # omit in 3.x!
                except UnicodeEncodeError:
                    pass

2 在mimetypes.py中加入设置默认编码(未测试)

 

 

reload(sys)

sys.setdefaultencoding("cp936")
0 0