Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
976 views
in Technique[技术] by (71.8m points)

java - unicode characters appear as question marks in IntelliJ IDEA console

I'm trying to write unicode characters (?) using System.out, and a question mark gets printed instead.

How can I have proper unicode characters displayed instead of question marks?

I'm using IntelliJ IDEA on Windows, and trying to print from within the IDE.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Go to Help > Edit Custom VM options... then add the following option:

-Dconsole.encoding=UTF-8
-Dfile.encoding=UTF-8

I'm not sure if both are necessary but it worked for me. You need to restart IntelliJ for changes to be applied.

I had already tried changing every encoding setting in Intellij, setting those options in Gradle and changing the system encoding, this is the only one that worked.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...