简体   繁体   中英

Definine Spyder coding utf-8

Due to a problem I had, all stange symbols such as à, ç... have changed to à or ç (all these no-ascii characters). This is happening every time I save a file in Spyder and I would want to know where can I cahange the encoding to utf-8 (the encoding when saving a file).

Thanks.

You can set the default encoding to utf by code:

import sys
reload(sys)
sys.setdefaultencoding('utf-8')

This is not recommended by many users, so try changing PYTHONIOENCODING="UTF-8" in your environment first.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM