简体   繁体   English

有没有办法在 java 上打印不同语言的字符?

[英]is there a way to print Characters from different languages on java?

I've been working on an assignment in java but when i try to write any Amharic characters they turn into boxes我一直在做 java 的作业,但是当我尝试写任何阿姆哈拉语字符时,它们会变成盒子

for example, when I try to print this Amharic character (አማርኛ) on IntelliJ or net beans it shows it as little boxes例如,当我尝试在 IntelliJ 或 net beans 上打印这个阿姆哈拉语字符 (አማርኛ) 时,它会将其显示为小框

if anyone is familiar with this please take a look, thanks in advance.如果有人熟悉这个,请看一下,提前谢谢。

I'm assuming you are referring to the output console in IntelliJ.我假设您指的是 IntelliJ 中的 output 控制台。 Default the console encoding is UTF-8.默认控制台编码为 UTF-8。 You can edit this setting.您可以编辑此设置。

Go to help >> edit custom vm options and add (first click "create" if it's your first time there): "-Dconsole.encoding=UTF-8" (but replace UTF-8 with the one you need) Go 帮助 >> 编辑自定义 vm 选项并添加(如果您是第一次,请先单击“创建”):“-Dconsole.encoding=UTF-8”(但将 UTF-8 替换为您需要的)

Google for "console encoding" + name of your editor if you want more information.如果您想了解更多信息,请搜索“控制台编码”+ 编辑器名称。 Good luck: :)祝你好运: :)

You a need a font that supoorts Amharic.你需要一种支持阿姆哈拉语的字体。

I am using Abyssinica SIL as an example below and NetBeans IDE我使用阿比西尼卡 SIL 作为下面的示例和 NetBeans IDE

Editor编辑

  • unpack the zip file a and install the font by running "AbyssinicaSIL-Regular.ttf" file解压 zip 文件 a 并通过运行“AbyssinicaSIL-Regular.ttf”文件安装字体
  • In Netbeans IDE select Tools > Options and click the Fonts & Colors icon In Netbeans IDE select Tools > Options and click the Fonts & Colors icon
  • On the Syntax tab click the braces (...) on the right of the Font field and choose the Abyssinica SIL font you just installed, and click OK.在语法选项卡上单击字体字段右侧的大括号(...)并选择您刚刚安装的 Abyssinica SIL 字体,然后单击确定。
  • Amharic text should now be correctly desplyed in the editor window but not in the output window.现在应该在编辑器 window 中正确显示阿姆哈拉语文本,但在 output window 中不能正确显示。 For the output follow below steps对于 output,请按照以下步骤操作

Output Output

  • In NetBeans Ouput window right click and select Settings... , click the Miscellaneous icon, and then click the Output tab在 NetBeans 输出 window 右键单击和 select设置... ,单击杂项图标,然后单击Z29C04A254472A361C2CDCD
  • Click the Import... button单击导入...按钮
  • Click the Browse... button and choose the Zip file you downloaded above.(AbyssinicaSIL-2.000.zip)单击浏览...按钮并选择您在上面下载的Zip文件。(AbyssinicaSIL-2.000.zip)
  • click OK to close the Select Options to import window you'll get a warning "Import may irreversibly overwrite your current settings..." You can trust me on this and ignore the warning and click Yes to continue and restart NetBeans.单击“确定”关闭Select 选项以导入 window您将收到警告“导入可能会不可逆地覆盖您当前的设置...”您可以相信我并忽略警告并单击“是”继续并重新启动 Z69F0F6923BC1F8AAAZ26B96BC88
  • After the restart: right click on the Ouput window and select Settings... > Miscellaneous > Output Click on the (...) button to the right of the Font field and choose the Abyssinica SIL font and click OK .重启后:右击Ouput window和select Settings... > Miscellaneous > Output点击字体右侧的(...)按钮并点击Abyssinica SIL字体。 Amharic text will now render correctly in the Output window.阿姆哈拉语文本现在将在 Output window 中正确呈现。

ይህ መልስ ጠቃሚ ነበር ብዬ ተስፋ አደርጋለሁ ፡፡ ይህ መልስ ጠቃሚ ነበር ብዬ ተስፋ አደርጋለሁ ። መልካም ምሽት እመኛለሁ ፡፡ መልካም ምሽት እመኛለሁ ።

This link talks nicely on using PrintStream object on achieving what you require - link此链接很好地讨论了使用 PrintStream object 实现您的要求 - 链接

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

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