【发布时间】:2018-07-19 14:05:25
【问题描述】:
我在 docker 容器中运行 python 3.6 + gunicorn + django 2.0.5 和一些西里尔文项目,这就是我尝试使用 Django 在控制台中记录西里尔文字符串时看到的内容。
'ascii' codec can't encode character '\u0410' in position 0: ordinal not in range(128)
这也是shell中发生的事情
Python 3.6.5 (default, May 3 2018, 10:08:28)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> :�ириллица
同时,当我在 docker 容器外运行 python 3.5 时,一切正常:
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> Кириллица
有什么想法可以让 docker 中的 python 3.6 与西里尔字符串一起正常工作吗?
【问题讨论】:
-
这不是字符串,这是标识符。
标签: python django unicode cyrillic