1

I have Eclipse 2022, which now has UTF-8 as default, and I'm trying to print Japanese characters. Such as:

System.out.println("わ"); 

The problem is that in the console, it just prints out ? marks. The closest thing I found to someone having the same problem as me would be: UTF-8 text (Hindi) not getting displayed on Browser window or Eclipse console

Remy Lebeau
  • 505,946
  • 29
  • 409
  • 696

1 Answers1

3

This has nothing to do with Java's UTF-8 support. String and println() always already correctly supported Unicode out of the box.

The result of this solely depends on whether your console supports Unicode or not. I suspect you used Windows CMD, which does not support Unicode by default.

Also see: How to use unicode characters in Windows command line?


The mentioned "UTF-8 by default" feature is for stuff like new FileReader(...) or new String(...), APIs that defaulted to the platform's default encoding in the past.

Remy Lebeau
  • 505,946
  • 29
  • 409
  • 696
Zabuzard
  • 23,461
  • 7
  • 54
  • 77
  • How would I fix this would I do this threw the eclipse setting or threw some kind command prompt – Andre Mercado May 22 '22 at 00:47
  • Your Java code is correct. Your console lacks unicode support, thats all. Either use a different console or adjust your console settings as explained in the linked thread. – Zabuzard May 22 '22 at 00:48
  • 2
    Or the console has unicode support but isn't using a font that includes that glyph. – Shawn May 22 '22 at 04:26