在Python中,默认编码存储在'unicode_default_encoding'中,我找到了所有Python源代码,有2个函数。
_PyUnicode_Init()//strcpy(unicode_default_encoding, "ascii");setencoding()在 site.py 中
所以没有人修改默认编码。那为什么我的默认编码是“utf-8”?
请您参考如下方法:
看起来 site.py 中的设置会影响默认编码。
查看 http://blog.ianbicking.org/illusive-setdefaultencoding.html
Edit site.py (in the standard library) directly. Seems like a bad idea. Though maybe I'll just delete the del sys.setdefaultencoding line... anyway, site.py might appear in other places on your computer as well (e.g., /etc/pythonX.Y/site.py).
