如何获得Mocha的Unicode输出以在Windows控制台中正确显示? [英] How can I get Mocha's Unicode output to display properly in a Windows console?

查看:71
本文介绍了如何获得Mocha的Unicode输出以在Windows控制台中正确显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行 Mocha 时,它会尝试显示对勾标记或X,以表示通过或分别失败的测试运行.我看过Mocha输出的漂亮截图.但是这些屏幕截图都是在Mac或Linux上拍摄的.在Windows的控制台窗口中,这些字符都显示为无描述的空框字符,即经典的呵呵".字形:

When I run Mocha, it tries to show a check mark or an X for a passing or a failing test run, respectively. I've seen great-looking screenshots of Mocha's output. But those screenshots were all taken on Macs or Linux. In a console window on Windows, these characters both show up as a nondescript empty-box character, the classic "huh?" glyph:

如果我在控制台窗口中突出显示文本并将其复制到剪贴板,则会看到实际的Unicode字符;我可以将奇特的字符粘贴到Web浏览器的文本框中,它们呈现的很好(✔,✔).因此,Unicode输出可以很好地到达控制台窗口.问题是控制台窗口无法正确显示这些字符.

If I highlight the text in the console window and copy it to the clipboard, I do see actual Unicode characters; I can paste the fancy characters into a textbox in a Web browser and they render just fine (✔, ✖). So the Unicode output is getting to the console window just fine; the problem is that the console window isn't displaying those characters properly.

如何解决此问题,以便使Mocha的所有输出(包括✔和✖)在Windows控制台中正确显示?

How can I fix this so that all of Mocha's output (including the ✔ and ✖) displays properly in a Windows console?

推荐答案

更新:此问题现已修复.从Mocha 1.7.0开始,回退用于默认控制台字体(√代替✔,×代替✖等)中不存在的符号.它虽然不尽如人意,但却可以击败空框占位符.

Update: this issue has now been fixed. Starting from Mocha 1.7.0, fallbacks are used for symbols that don't exist in default console fonts (√ instead of ✔, × instead of ✖, etc.). It's not as pretty as it could be, but it surely beats empty-box placeholder symbols.

有关详细信息,请参阅相关的请求请求: https://github.com/visionmedia/mocha /pull/641

For details, see the related pull request: https://github.com/visionmedia/mocha/pull/641

这篇关于如何获得Mocha的Unicode输出以在Windows控制台中正确显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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