Yauhen
Yauhen

Reputation: 2535

Output window in Netbeans 7.2 can't correctly display thai symbols

Need your help. I have an annoying issue: thai symbols can't be printed pretty in Netbeans 7.2 output window:

Output after System.out.println(...); ???????????????????[TH_WORD]

I changed netbeans.conf as mentioned, it doesn't help; I changed project properties->Sources encoding to UTF-8 and sources looks good, all thai symbols in sources are correctly printable. But how to change settings of NB output window?

Windows 7 64bit, Netbeans 7.2 (I run NB as "C:\Program Files (x86)\NetBeans 7.2\bin\netbeans64.exe" --locale en_US)

Upvotes: 1

Views: 4857

Answers (4)

Jeff_Alieffson
Jeff_Alieffson

Reputation: 2872

For Azerbaijani language I tried this:

  • added System.setOut(new PrintStream(System.out, true, "UTF8")); into my code. After this correction it changed ? marks into different symbols. The word tədarük before displayed as t?dar?k. But now it standed tЙ™darГјk
  • then I added -Dfile.encoding=utf-8 into the Run arguments on Project properties, no way
  • then tested with -Duser.language=az, result was the same
  • changed the font on Output console (right click on console and on Settings window changed Monospaced font into Arial, nothing changed

It did not help. Only after changing Netbeans config it worked. I opened netbeans.conf, in my case it was in C:\Program Files\NetBeans 7.4\etc folder, on linux it'll /usr/local/netbeans-7.4/etc/netbeans.conf

I added -J-Dfile.encoding=UTF-8 into the end of netbeans_default_options just before the quotation mark. Restarted NetBeans. Now it works even with Monospaced font and without setting -Duser.language param.

So I needed only two things.

  1. add -J-Dfile.encoding=UTF-8 into netbeans_default_options in netbeans.conf
  2. change output string encoding in your code: System.setOut(new PrintStream(System.out, true, "UTF8"));

Upvotes: 2

Jewel
Jewel

Reputation: 363

you can add system variable in mycomputer

JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8

Upvotes: 0

Yauhen
Yauhen

Reputation: 2535

Solved thanks to conversation Java: How to detect (and change?) encoding of System.console?

The solution was founded and applied:

PrintStream out = new PrintStream(System.out, true, "UTF-8");

use appropriate import java.io.*, indeed.

Upvotes: 2

Jim Garrison
Jim Garrison

Reputation: 86774

The solution will be to change the font being used for the console output window to one that includes Thai characters. In Eclipse this is possible in the Preferences dialog. It's been at least 5 years since I used NetBeans, but I'm 99% certain something similar is available there too.

Upvotes: 0

Related Questions