apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.61k stars 836 forks source link

NetBeans 21 console Chinese characters are garbled #7098

Closed yuedaxia76 closed 5 months ago

yuedaxia76 commented 5 months ago

Apache NetBeans version

Apache NetBeans 21 release candidate

What happened

System.out.println("中文a"); result is :中文a in netbeans 21 it is:����a

Even after setting set -J-Dfile.encoding=UTF-8 ,-J-Dfile.encoding=GBK ,there are still garbled characters

Language / Project Type / NetBeans Component

maven project

How to reproduce

run 👍 public static void main(String[] argm) throws Exception { System.out.println(System.getProperty("file.encoding")); System.out.println(Charset.defaultCharset()); //System.setProperty("console.encoding", "UTF-8"); System.out.println("中文a"); System.setOut(new PrintStream(System.out,true,"UTF-8")); System.out.println("中文a");

}

Did this work correctly in an earlier version?

Apache NetBeans 20

Operating System

windows 10

JDK

test in 17、21

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

No response

Are you willing to submit a pull request?

No

yuedaxia76 commented 5 months ago

I user netbeans 21 release version.

yuedaxia76 commented 5 months ago

test reult

neilcsmith-net commented 5 months ago

You need to set stdout.encoding - see also #4771

yuedaxia76 commented 5 months ago

set -J-Dstdout.encoding=GBK in netbeans.conf is ok 。 Old version ready to use out of the box, no need to set up。