hebrew appears as question marks in netbeans
Asked Answered
C

8

7

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

Communicant answered 19/3, 2009 at 13:15 Comment(1)
Did you ever find a solution for this? None of the solutions below worked for me.Justness
A
3

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.
Aphorize answered 19/3, 2009 at 13:56 Comment(0)
N
2

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.

Nucleo answered 19/3, 2009 at 16:54 Comment(1)
Cool, so how do I change the the JVM Netbeans uses?Communicant
F
1

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.

Feud answered 19/3, 2009 at 13:24 Comment(3)
you mean Windows language pack?Communicant
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.Feud
'?' means the encoding is set up wrong, boxes mean the font doesn't support the characters.Aphorize
U
1

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.

Uprising answered 19/3, 2009 at 16:3 Comment(2)
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.Communicant
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?Uprising
A
1

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

Aphorize answered 19/3, 2009 at 17:0 Comment(0)
H
0

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.

Hybridism answered 19/3, 2009 at 13:21 Comment(0)
I
0

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

Inexplicable answered 25/12, 2013 at 7:9 Comment(0)
L
0

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.

Laris answered 22/2, 2017 at 14:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.