美文网首页
Note - ubuntu下 utf-8编码问题

Note - ubuntu下 utf-8编码问题

作者: 汉江岳 | 来源:发表于2019-12-27 16:31 被阅读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

相关文章

网友评论

      本文标题:Note - ubuntu下 utf-8编码问题

      本文链接:https://www.haomeiwen.com/subject/rbuxuctx.html