如何将[简体中文]汉字打印到Eclipse控制台? [英] How to print [Simplified] Chinese characters to Eclipse console?

查看:224
本文介绍了如何将[简体中文]汉字打印到Eclipse控制台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.util.Locale;

public final class ChineseCharacterDemo {

    public static void main(String[] args) throws UnsupportedEncodingException {
        Locale locale = new Locale("zh", "CN");
        System.out.println(locale.getDisplayLanguage(Locale.SIMPLIFIED_CHINESE));
    }

}

的Eclipse控制台到UTF-8,我得到盒,而不是以下:

And even after setting the character encoding of the Eclipse console to UTF-8, I get boxes, instead of the following:

中文

我做错了什么?

将Eclipse控制台字体更改为能够呈现中文字符的字体后,我得到以下不正确的显示:

After changing the Eclipse console font to something capable of rendering Chinese characters, I get the following, incorrect, display:

>

但是,当我在这里复制/粘贴文本时,它会正确呈现简体中文文本。再次,这里发生了什么?实际上,如果你看看控制台中渲染的文本,它是正确的字符,但他们在他们身边!

But, when I copy/paste the text here, it correctly renders the Simplified Chinese text. Again, what's going on here? Actually, if you look at the rendered text in the console, it's the correct characters, but they're on their side!

所以,我需要做以下事情:

So, it turns out that I needed to do the following:


  1. 将Eclipse控制台的字符编码更改为UTF-8

  2. 将字体更改为Arial Unicode MS(即任何能够呈现中文文本的字体)


推荐答案

将控制台的字体更改为实际包含您需要查看的中文字符的字体。

Change the font for the Console to one which actually contains the Chinese characters you need to see.

这篇关于如何将[简体中文]汉字打印到Eclipse控制台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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