希伯来语在 Netbeans 中显示为问号

发布于 2024-07-15 06:19:53 字数 561 浏览 10 评论 0原文

我在 2 台计算机上使用 netbeans 6.1。

其中一个程序:

public static void main(String argv[]) 
{
        System.out.println("שלום");
}

正常打印,而另一个问号。
这两种环境有什么区别?

编辑: 在两台计算机上 控制面板\区域和语言选项\高级 设置为希伯来语
编辑: 谢谢迈克尔·伯尔, 但编码的值已经是UTF-8了。 也许这与 JVM 有关?
编辑: 我安装了Eclipse,也出现这个问题。 我还尝试从文件中读取希伯来语,结果相同。
编辑: <代码> System.getProperty("文件.编码"); 返回“Cp1252” 我试过 <代码> System.setProperty("文件.编码","UTF-8") 但问题依然存在。

谢谢,
我愿意

I am using netbeans 6.1 on 2 computers.

on one of them the program:

public static void main(String argv[]) 
{
        System.out.println("שלום");
}

prints normally, and the on the other question marks.
what can be the difference between the 2 environments?

edit:
on both computers
Control Panel \ Regional and Language Options \ Advanced
is set to hebrew

edit:
Thank you Michael Burr,
but the value of the encoding is already UTF-8.
Maybe this something with the JVM?

edit:
I have installed Eclipse and the problem occurs there as well.
I also tried reading the hebrew from a file with the same result.

edit:

System.getProperty("file.encoding");

returns "Cp1252"
I tried

System.setProperty("file.encoding","UTF-8")

but the question marks remains.

Thanks,
Ido

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

风渺 2024-07-22 06:19:53

确保 NetBeans 设置为支持希伯来语字符的编码。 来自 NetBeans Wiki

要更改项目的语言编码:

  1. 右键单击“项目”窗口中的项目节点,然后选择“属性”。
  2. 在“源”下,从“编码”下拉字段中选择一个编码值。

Make sure that NetBeans is set up with an encoding that supports Hebrew characters. From the NetBeans Wiki:

To change the language encoding for a project:

  1. Right-click a project node in the Projects windows and choose Properties.
  2. Under Sources, select an encoding value from the Encoding drop-down field.
雨巷深深 2024-07-22 06:19:53

您无法使用 System.setProperty() 设置“file.encoding”属性; 当 JVM 使用 -Dfile.encoding=UTF-8 启动时,必须在命令行上设置它。 该属性的值在 JVM 初始化期间读取并缓存。 当您的 main 方法被调用时,该值已被缓存并且对属性的更改将被忽略。

You can't set the "file.encoding" property with System.setProperty(); it has to be set on the command line when the JVM is started with -Dfile.encoding=UTF-8. The value of this property is read during JVM initialization and cached. By the time your main method is invoked, the value has been cached and changes to the property are ignored.

别再吹冷风 2024-07-22 06:19:53

默认安装希伯来语吗? 可能是没有安装语言包?

控制面板> 区域和语言选项> 语言。 选择“安装复杂脚本和从右到左语言(包括泰语)的文件”选项。 这将安装对希伯来语的支持。 您可能需要一张操作系统光盘。

Is Hebrew installed by default? Could be that a language pack isn't installed?

Control Panel > Regional and Language Options > Languages. Select the 'Install files for complex script and right-to-left languages (including Thai)' option. This will install support for Hebrew. You'll probably need an OS disc.

爱,才寂寞 2024-07-22 06:19:53

你到底是如何运行该程序的? 它在哪里打印输出? 它可以像 netbeans 或使用不同字体的控制台一样简单,其中一种字体不包含希伯来语字符。

要消除编译期间的编码问题,请尝试将希伯来语字符替换为 unicode 转义序列 并查看结果是否不同。

How exactly are you running the program? Where does it print its output? It could be as simple as netbeans or the console using different fonts, one of which does not include Hebrew characters.

To eliminate encoding problems during compilation, try replacing the Hebrew characters with their unicode escape sequences and see if the result is different.

旧时光的容颜 2024-07-22 06:19:53

我想我误解了你的问题(我认为字符没有正确显示在 NetBeans 编辑器中)。 解决问题的具体步骤可能取决于您所运行的操作系统的版本。 不幸的是,Win2K、WInXP 和 Vista 的对话框和措辞都略有不同。

查看 JVM 的帮助页面:

听起来您已经按照应有的方式配置了系统,但问题在于细节 - 系统上有几种不同的“区域设置”设置可能会影响此设置(据我所知,JVM 可能会自行添加一两个)。

I think I misunderstood your problem (I thought that the characters were not being displayed in the NetBeans editor properly). The exact steps to solve your problem might depend on the version of the OS you're running on. Win2K, WInXP, and Vista all have slightly different dialogs and wording unfortuantely.

Take a look at this help page for the JVM:

It sounds like you've already configured the system like it should be, but the devil is in the details - there are several different 'locale' settings on a system that might affect this (and for all I know the JVM might throw in one or two on its own).

初见终念 2024-07-22 06:19:53

通常它是默认编码:

控制面板 \ 区域和语言选项 \ 高级
(在组合上选择希伯来语)

更改此设置后,您必须重新启动。

Usually it's the default encoding on:

Control Panel \ Regional and Language Options \ Advanced
(Select Hebrew on the combo)

You'll have to restart after changing this setting.

苏佲洛 2024-07-22 06:19:53

对我有帮助的是这个(在Win7上):
在此处输入图像描述

What helped me is this (on Win7):
enter image description here

岁月染过的梦 2024-07-22 06:19:53

上面的答案没有一个是行不通的。

我花了大约一个小时,但发现问题不在于字符串编码,而在于IDE从启动时就使用的默认编码。

因此,要在 Netbeans 控制台输出中获取希伯来语、阿拉伯语、俄语等符号,您需要修改 netbeans.conf

搜索键 netbeans_default_options 并将 -J-Dfile.encoding=UTF-8 添加到引号中。

No one answer from above doesn't work.

I spent about an hour, but had figured out, that the problem is located not in the String encoding, but in default encoding, which is used by IDE from the start-up.

So, to get Hebrew, Arabic, Russian etc symbols in Netbeans console output you need to modify netbeans.conf.

Search for the key netbeans_default_options and add -J-Dfile.encoding=UTF-8 into the quotes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文