Sublime 不会在 Windows 上打印某些 unicode 字符 [英] Sublime will not print certain unicode chars on windows

查看:42
本文介绍了Sublime 不会在 Windows 上打印某些 unicode 字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近在我的工作机器(windows)上遇到了一些问题,打印某些 Unicode 字符时没有显示任何内容.没有错误,只是脚本完成并且构建部分中有空白.

举个例子:

print(u'New Year\u2019s Day')

<块引用>

[0.2s 完成]

不知道为什么会发生这种情况,因为就我所知,sublime 中的默认编码是 utf-8,而 \u2019 显然是一个有效的 utf-8 字符.

根据要求...崇高的配置:

<代码>{"cmd": ["C:/Users/<用户名>/AppData/Local/Continuum/Anaconda3/python.exe","$file"],选择器":source.py"}

解决方案

尝试在构建配置中设置 PYTHONIOENCODING=utf-8 环境:

<代码>{"cmd": ["C:/Users/<用户名>/AppData/Local/Continuum/Anaconda3/python.exe","$file"],"选择器":"source.py","env": { 'PYTHONIOENCODING": "utf-8" }}

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"
}

解决方案

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" }
}

这篇关于Sublime 不会在 Windows 上打印某些 unicode 字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆