Note - ubuntu下 utf-8编码问题
2019-12-27 本文已影响0人
汉江岳
ubuntu 系统对IO数据有自己默认的编码设置
如果default的io编码不是en_US.UTF-8, 则对于运行python程序:
方法1:在运行程序前告诉python解释器编码类型
PYTHONIOENCODING=utf-8 python xxx.py # If this is set before running the interpreter, it overrides the encoding used for stdin/stdout/stderr.
方法2:修改ubuntu系统环境变量
参见https://perlgeek.de/en/article/set-up-a-clean-utf8-environment