【问题标题】:Why Eclipse does not displaying UTF-8 chars为什么 Eclipse 不显示 UTF-8 字符
【发布时间】:2015-11-08 20:57:30
【问题描述】:

我正在使用 eclipse Luna,当我尝试获取包含缅甸语的 json 结果时,我得到了奇怪的字符,例如:

我的代码:

        InputStream is  = connection.getInputStream();
        StringWriter sw = new StringWriter();
        IOUtils.copy(is, sw,"UTF-8");
        String s=sw.toString();
        JSONObject mainjobj= new JSONObject(s);

到目前为止我尝试了什么?..

  • 我这样做了:Windows > Preferences > General > Content Types,将 UTF-8 设置为所有内容类型的默认编码

  • 还有这个:Windows > Preferences > General > Workspace,将“Text file encoding”设置为“Other : UTF-8”

但这两个对我不起作用。

您对此有何建议?

【问题讨论】:

  • 首选项中的详细信息视图使用什么字体?
  • 因为你没有告诉它使用合适的字体。
  • @drrob 'Consolas' 字体-我认为默认-
  • @bmargulies 我怎么知道这个?
  • Consolas 的语言字形肯定是有限的。也许这可以帮助myanmarlanguage.org/note/fixed-width-font-burmese-programming

标签: java json eclipse character-encoding utf


【解决方案1】:

这是字体问题;大多数固定宽度字体(包括 Consolas)不支持缅甸字形,因为它们无法正确呈现固定宽度。

见:http://www.myanmarlanguage.org/note/fixed-width-font-burmese-programming

【讨论】:

    猜你喜欢
    • 2012-01-11
    • 2011-06-15
    • 1970-01-01
    • 2013-04-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-18
    • 1970-01-01
    相关资源
    最近更新 更多