msysgit:Unicode 字体警告
最近,我在使用 msysgit 时遇到此错误,特别是当 git 输出生成一些非 ASCII 内容时:
警告:您的控制台字体可能不支持 Unicode。如果您在输出中遇到奇怪的字符,请考虑切换到 TrueType 字体,例如 Lucida Console!
有趣的是,虽然该消息告诉我我的字体不支持 Unicode,但它实际上支持 Unicode,并且相关文本显示正确(以正确的编码和显示所有字符)。
可悲的是我没有找到禁用此消息的方法。我尝试更改 Git Bash 中的字体(我通常使用 PowerShell),但是当我检查那里的字体时,我注意到它实际上已经设置为 Lucida Console,并且警告出现在同一个控制台中也。所以我有点不知道如何解决这个问题,或者至少阻止 msysgit 一直打印这个警告。
我尝试重新安装 msysgit,也选择了将字体设置为 Lucida Console 的选项,但没有帮助。我能做些什么?
Recently I am getting this error when using msysgit, in particular when there is some non-ASCII content generated by the git output:
warning: Your console font probably doesn't support Unicode. If you experience strange characters in the output, consider switching to a TrueType font such as Lucida Console!
The funny thing is that although that message is telling me that my font doesn't support Unicode, it actually does and the text in question is displayed correctly (in the correct encoding & with all characters displayed).
The sad thing is that I don't find a way to disable this message. I tried changing the font in the Git Bash (I usually use PowerShell) but when I checked the font there, I noticed that it was actually already set to Lucida Console, and the warning appears in that same console too. So I'm a bit clueless what to do to fix this, or at least stop msysgit from printing this warning all the time.
I tried reinstalling msysgit, also with the option selected that is supposed to set the font to Lucida Console, but it didn't help. What can I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
实际上,它是在谈论更改命令提示符中的字体。
:]
Actually it is talking about changing the font in your Command Prompt.
:]
该测试由
compat/winansi.c
中的函数warn_if_raster_font
完成。这使用 Win32 API GetCurrentConsoleFontEx 来查找附加到当前输出流的控制台正在使用的字体。此测试在 Windows Vista 及更高版本上应该始终正确。在 Windows XP 上,它必须在注册表中查找当前默认的控制台字体。因此,您可能使用的是 XP,并且当您为正在使用的控制台配置了快捷方式时,默认设置仍配置为使用非 unicode 字体。如果没有,您可以尝试编译以下使用大致相同代码的代码,然后查看它打印出来的内容。如果输出包含 tt: 4,我们希望相应的 git 代码能够正确检测您的控制台字体为 truetype。
This test is done by the function
warn_if_raster_font
incompat/winansi.c
. This uses the Win32 API GetCurrentConsoleFontEx to find the font in use by the console attached to the current output stream. This test should always be correct on Windows Vista and above. On Windows XP it has to resort to looking in the registry for the current default console font. So possibly you are on XP and while you have configured the shortcut for the console you are using, the default setting remains configured to use a non-unicode font.If not, you might try compiling the following which uses roughly the same code and see what it prints out. Provided the output contains tt: 4 we would expect the corresponding git code to properly detect your console font as truetype.