且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Netbeans控制台不显示Bangla unicode字符

更新时间:2023-12-05 13:16:52

您似乎正在使用Netbeans。 Netbeans中的控制台默认使用Monospace字体,无法显示Bangla字符。

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:

然后选择使用带有Bangla字形的字体显示控制台中的所有字符(我选择Arial Unicode MS,但您可以选择任何其他Bangla字体):

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):

这将显示您想要的输出:

This would display the output that you desire:

另外,请注意Netbeans项目编码的重要性:

Also, note the importance of the Netbeans project encoding:

显然,控制台编码恰好相同作为项目en编码;试图通过设置 file.encoding 系统属性来改变这一点。在这种情况下,将显示所有UTF-8编码的字符串而不会出现问题。但是,如果您的文件恰好使用UTF-16BE / LE或任何其他编码方案进行编码,则控制台将显示乱码/ mojibake 因为无法根据需要更改终端/控制台编码。在这种情况下,首选方法是以与项目编码相同的编码存储文件,以便通过 System.out 显示其内容不会导致显示乱码。

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.