for a study project I am using java to develop a game.
I need to fill the board (chess-like) with these characters "⛀", "⛁","⛂","⛃" (Unicode: "U+26C0","U+26C1 ","U+26C2","U+26C3").
I get the correct printing only if I use, to run the application, git Bash; otherwise, for example on Powershell, I get '?' or other random stuff.
To print I just use the line (for example): System.out.print(" " + "\u26C2" + " ");
How can I get the application to print the correct characters in every terminal I decide to run from?
Thanks.
Asked
Active
Viewed 59 times
0

UStBB
- 41
- 4
-
2Java can't help you with that. Use a character that you know works everywhere, or don't use a terminal at all. – Clashsoft Apr 14 '21 at 12:35
-
2https://stackoverflow.com/q/49476326/15273968 – the Hutt Apr 14 '21 at 12:36
-
"print the correct characters in every terminal I decide to run from": Set the terminal to support unicode. If the terminal not supports unicode then printing unicode characters will fail. – Axel Richter Apr 14 '21 at 12:38
-
Different terminals have different unicode encodings and support different characters. Some terminals might support UTF-8 (Most characters) while others don't. – CodingM Apr 14 '21 at 12:39