Windows 命令行上的 Unicode 输出? [英] Unicode output on Windows command line?
问题描述
我编写了一个小型 Java 应用程序,它的输出包含 Unicode 字符.当我使用 Eclipse 运行它时—我看到了所有预期的输出.
I wrote a small Java application which output includes Unicode characters. When I use Eclipse to run it—I see all the output as expected.
应该使用该应用程序的人会将其作为 jar 文件运行.我以为他们可以使用标准的 cmd 窗口,但在这个窗口中,Unicode 显示为乱码.
The people who are supposed to use the application will run it as a jar file. I thought they could use standard cmd window, but in this window the Unicode appear as Gibberish.
有没有办法让cmd 窗口"识别 Unicode 字符并正确显示它们?或者,有没有什么工具可以轻松运行jar文件并得到正确的输出?
Is there a way to make "cmd window" recognize the Unicode chars and display them properly? Or, is there any tool to easily run the jar file and get the correct output?
顺便说一句 - 将输出重定向到文件可以正常工作,但程序是交互式的,所以这不是一个好的解决方案.
BTW - redirecting the output to a file works okay, but the program is interactive, so this will not be a good solution.
感谢大家的建议.cmd字体似乎没有我需要的特定字符,这就是为什么更改代码页没有解决我的问题.
Thanks everybody for the suggestions. It seems that the cmd fonts don't have the specific characters I need, and this is why changing the code page did not solve my problem.
我找到了一种方法来添加更多等宽字体到控制台,但在我添加它们之后,我想要对字体进行的任何更改(甚至选择不同大小的原始字体之一) - 都将被忽略.
I found a way to add more monospaced fonts to the console, but after I add them any change that I want to do regarding the fonts (even choosing one of the original fonts in a different size) - is ignored.
我想我会简单地尝试使用另一个工具,它支持更轻松地选择不同的字体.
I think that I will simply try with another tool, which supports chhosing a differnt font more easily.
推荐答案
从命令行尝试 chcp 1252
或 chcp 65001
.使用 Lucida Console 或其他字体支持.
Try chcp 1252
or chcp 65001
from the command line. With Lucida Console or other font support.
这篇关于Windows 命令行上的 Unicode 输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!