Title pretty much sums it up. I'm trying to display the chess unicode characters in the win10 command prompt and it displays the replacement character (�) instead (copy pasting that gives me the correct character again)
Enforcing UTF-8 encoding. Setting the CMD Charpage to UTF-8 encoding. Using the unicode characters instead of codes in my strings.
$icons = {
"Pawn" => "\u2659", # ♙
"Rook" => "\u2656", # ♖
"Knight" => "\u2658", # ♘
"Bishop" => "\u2657", # ♗
"Queen" => "\u2655", # ♕
"King" => "\u2654", # ♔
"Black" => "\u25A0", # ■
"White" => " " #
}
class Graphics
def display_board(b);
system ("cls")
#system ("chcp 65001")
board = b.get_map();
board.each_with_index do |subarr,x|
str = "";
subarr.each_with_index do |value,y|
str += "[" + $icons[value] + "]";
end
puts(str);
end
end
end
Expected result is this :
[♖][♘][♗][♔][♕][♗][♘][♖]
[♙][♙][♙][♙][♙][♙][♙][♙]
[ ][■][ ][■][ ][■][ ][■]
[■][ ][■][ ][■][ ][■][ ]
[ ][■][ ][■][ ][■][ ][■]
[■][ ][■][ ][■][ ][■][ ]
[♙][♙][♙][♙][♙][♙][♙][♙]
[♖][♘][♗][♔][♕][♗][♘][♖]
Actual result : � for every chess piece.