Hi, 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
-
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.
-
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.
idober : you mean Windows language pack?Jeremy Cron : yes. I'm not sure about Hebrew, but we had to install a separate language pack for Japanese. we saw '?' in some places and 'boxes' in others.Michael Burr : '?' means the encoding is set up wrong, boxes mean the font doesn't support the characters. -
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:
- Right-click a project node in the Projects windows and choose Properties.
- Under Sources, select an encoding value from the Encoding drop-down field.
-
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.
idober : a very strange thing happened, after i changed the the added a VM option: "-Dfile.encoding=UTF-8" It worked. but after I restarted my computer i got ש�וֹט instead of Hebrew, even when i use Unicode escape sequences.Michael Borgwardt : That VM option shouldn't be able to have any effect after a restart, but maybe your also fiddled with the locale settings and that took effect only after a restart? -
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 yourmain
method is invoked, the value has been cached and changes to the property are ignored.idober : Cool, so how do I change the the JVM Netbeans uses? -
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).
-
I have found what I was looking for: VM options
Thanks guys for the help
Although It is an ad-hoc solution, it serves my needs for now.
0 comments:
Post a Comment