Netbeans console does not display Bangla unicode characters

前端 未结 2 1184
礼貌的吻别
礼貌的吻别 2020-11-28 12:41

I have a test.txt file with some Bengali character written as

আমার মাথা, তোমার মাথা

Now when I run this from some packege,

相关标签:
2条回答
  • 2020-11-28 13:11

    Font download link: code.google.com

    Here is the look to get solved the font problem in netbeans:

    0 讨论(0)
  • 2020-11-28 13:25

    You seem to be using Netbeans. The console in Netbeans uses a Monospace font by default, that is incapable of displaying Bangla characters.

    You can switch to a different font from the context menu:

    Choose Font for Netbeans Console

    and then opt for displaying all the characters in the console using a font with the Bangla glyphs (I chose Arial Unicode MS, but you can choose any other Bangla font):

    Choose Font in Dialog

    This would display the output that you desire:

    Display bangla characters

    Also, note the importance of the Netbeans project encoding:

    Netbeans project encoding

    Apparently, the console encoding happens to be the same as the project encoding; attempting to change this by setting the file.encoding System property yields nothing. In this case, all UTF-8 encoded strings will be displayed without issues. However, if your file happens to be encoded with UTF-16BE/LE or any other encoding scheme, then the console will display gibberish/mojibake as it is impossible to change the terminal/console encoding on an as needed basis. In this case, the preferred approach is to store files in the same encoding as the project encoding, so that displaying their contents via System.out will not result in displaying gibberish.

    0 讨论(0)
提交回复
热议问题