简体   繁体   English

在 NetBeans 中看不到僧伽罗 Unicode 字符

[英]Can't see Sinhala Unicode characters in NetBeans

I tried to print Sinhala characters in NetBeans 7.1 Java application.(In windows 7) Other languages like Chinese and Urdu .. etc will show the correct character.我试图在NetBeans 7.1 Java 应用程序中打印僧伽罗语字符。(在 Windows 7 中)其他语言,如中文和乌尔都语 .. 等将显示正确的字符。 But Sinhala characters are not displaying correctly.但是僧伽罗字符显示不正确。 It will display as little boxes both in the code and the output.它将在代码和输出中显示为小框 though here in SO it show as "සිංහල" .虽然在这里它显示为 "සිංහල" 。 How can I fix it ?我该如何解决?

I can do this without a problem in eclipse environment.我可以在 eclipse 环境中毫无问题地做到这一点。

    String a = "世界你好";
    System.out.println(a);
    System.out.println("कई");

    // sinhala
    char c = '\u0D85';
    System.out.println(c);
    System.out.println("\u0D85");
    System.out.println("සිංහල");

    System.out.println(java.nio.charset.Charset.defaultCharset().name());

I tried changing the Sources -> Encoding type to UTF-8.我尝试将 Sources -> Encoding type 更改为 UTF-8。 and now my netbeans.conf file I changed netbeans_default_options and added -J-Dfile.encoding=UTF-8 like below现在我的 netbeans.conf 文件我更改了netbeans_default_options并添加了-J-Dfile.encoding=UTF-8如下所示

netbeans_default_options="-J-Dfile.encoding=UTF-8 -J-Dorg.netbeans.modules.tomcat.autoregister.token=1378930362898 -J-Dorg.netbeans.modules.tomcat.autoregister.catalinaHome=\"C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.20\" -J-Dorg.glassfish.v3ee6.installRoot=\"C:\Program Files\sges-v3\" -J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true"

How can I fix this.我怎样才能解决这个问题。 ? ?

The default monospaced font in Netbeans is not sufficient for unicode characters. Netbeans 中的默认等宽字体对于 unicode 字符是不够的。 Try using a unicode font that supports Sinhala.尝试使用支持僧伽罗语的 unicode 字体。 Windows 8 comes with Iskoola Pota and Nirmala UI which can display Sinhala nicely. Windows 8 带有Iskoola PotaNirmala UI ,可以很好地显示僧伽罗语。 I don't know if you can find these two fonts on Windows 7, but you can download GNU FreeFont ( only FreeSerif has Sinhala) as an alternative to Iskoola Pota or Nirmala UI .不知道Windows 7上能不能找到这两种字体,不过大家可以下载GNU FreeFont只有FreeSerif有Sinhala)作为Iskoola PotaNirmala UI的替代品。

To see Sinhala characters in the editor display , select Netbeans menu: Tools => Options ==> Fonts & Colors => Syntax Tab => Category Default => Font and set it to either Iskoola Pota or Nirmala UI or FreeSerif .要在编辑器显示中查看僧伽罗字符,请选择 Netbeans 菜单:工具 => 选项 ==> 字体和颜色 => 语法选项卡 => 类别默认值 => 字体并将其设置为Iskoola PotaNirmala UIFreeSerif

Likewise, to see Sinhala characters in the output display , select Netbeans menu: Tools ==> Options ==> Miscellaneous ==> Output tab ==> Font and set it to either Iskoola Pota or Nirmala UI or FreeSerif .同样,要在输出显示中查看僧伽罗字符,请选择 Netbeans 菜单:工具 ==> 选项 ==> 杂项 ==> 输出选项卡 ==> 字体并将其设置为Iskoola PotaNirmala UIFreeSerif You can right click on the output display and choose Settings... to go there directly.您可以右键单击输出显示并选择设置...直接转到那里。

This is your code and output in Netbeans 8.0.2 on Windows 8 with FreeSerif font.这是您在 Windows 8 上的 Netbeans 8.0.2 中使用FreeSerif字体的代码和输出。

在此处输入图片说明

More reading on Sinhala fonts: Unicode Font and List of typefaces included with Microsoft Windows更多关于僧伽罗字体的阅读: Unicode 字体Microsoft Windows 中包含的字体列表

为每个文本框或编辑文本设置字体到 iscolapota。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM