777
777

Reputation: 11

Netbeans: UTF-8 characters Chinese Japanese (CJK) text do not print in Netbeans 20 (Java MAVEN) Output window

This is my Code:

package hello.learningjava;

public class NewClassTEST {

    public static String aMadeUpString() {
    
        return ("Holy moly cow, 你好 よくできました!");
    }
}

Image of the code

In main:

NewClassTEST b = new NewClassTEST();
String TEST = b.aMadeUpString();
System.out.println(TEST);`

Output: Holy moly cow, ?? ????????

What the output window shows

Expected Output: Print Holy moly cow, 你好 よくできました! in the Output Window (Clearly displaying CJK)

< --- attempts --- >

Tried following along some of the Stackoverflow answers in here - Netbeans 9 - Print Unicode Characters. Also tried looking into this user's question - Stackoverflow : NetBeans 15 Hindi Character Display Issue

Note: I opened an issue for myself in Github and what is written here is what I wrote there as well.

Tried adding

-J-Dfile.encoding=UTF-8 & -J-Dawt.useSystemAAFontSettings=On

at the end of

netbeans.conf located in C:\Program Files\NetBeans-20\netbeans\etc

image: C:\Program Files\NetBeans-20\netbeans\etc

image: Opened .conf in Notepad++

image: Added at the end of the code line

Source

I couldn't follow along every point in the first Stackoverflow link but here's what I have been able to try:

Added code and results: image: Netbeans IDE

(Netbeans' hints) Imported the following: image: import

Result: image: Result in Output Window

No longer ?????? but now it is: 你好 よ�������

<--- . --->

I've been looking for solutions since yesterday. It's been hours and I can't seem to find a resolution.

I made sure to restart Netbeans with every edit to the settings, tools>options>fonts... or config. I tried finding other questions of similar nature here but none of them have worked so far.

I tried installing various fonts and switching fonts. (Although what I downloaded were .otf, not .ttf) Tried importing new font .zip files (Noto JP, Noto Emoji)

Tried Monospace, Courier, Noto JP, Noto Emoji, Arial in both the MISCELLANEOUS > OUTPUT > FONT and TOOLS>OPTIONS>FONTS & COLORS. Note: Courier displays CJK text in the editing window, but not in the Output window.

I have restarted my PC several times.

I am new to programming so some of the possible solutions like

  1. From the Projects panel set {project} > Properties > Sources > Encoding to UTF-8.

from user skomisa, I could not execute. I'm not sure how to go about doing this. I tried looking online on how to find properties in the projects panel set, could I also be guided on how to do this?

If you know any other way to solve this, please let me know. Thank you!


[ EDIT 20240217 1835 ]

(build 1.8.0_51-b16)

Upvotes: 1

Views: 125

Answers (0)

Related Questions