Sublime will not print certain unicode chars on windows

て烟熏妆下的殇ゞ 提交于 2019-12-20 05:58:05

问题


Been having some issues lately on my work machine (windows), where printing certain Unicode characters displays nothing. No error, just the script finishes and there is empty space in the build section.

As an example:

print(u'New Year\u2019s Day')

[Finished in 0.2s]

Not sure why this is happening as the default encoding is utf-8 in sublime as far as i know, and \u2019 is very clearly a valid utf-8 character.

As requested... sublime config:

{
    "cmd": ["C:/Users/<username>/AppData/Local/Continuum/Anaconda3/python.exe","$file"],
    "selector":"source.py"
}

回答1:


Try setting PYTHONIOENCODING=utf-8 environment in your build config:

{
   "cmd": ["C:/Users/<username>/AppData/Local/Continuum/Anaconda3/python.exe","$file"],
   "selector":"source.py",
   "env": { 'PYTHONIOENCODING": "utf-8" }
}


来源:https://stackoverflow.com/questions/34361206/sublime-will-not-print-certain-unicode-chars-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!