Search code examples
c++unicodeconsole

C++ printing unicode characters gives question marks


I want to start by saying I know how to print Unicode characters to console using _setmode(_fileno(stdout), _O_U16TEXT). The problem I have is with printing Unicode characters that are "non-standard". For example, when I try to print ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ ▇ ▆ ▅ ▄ ▃ ▁ using wprintf, it returns this:

Picture showing output were all but half and full blocks are question marks

The project is set to "Unicode Character Set" and visual studio is showing the characters fine when showing them from file.

I found the answer and put it below


Solution

  • From what I have found so far. there is no easy work around except for using another font which does include those characters. What I ended up doing was just editing the font using Fontlab. If anyone else ends up follow my footsteps. once you finish editing:

    1. change the font name unless you want to overwrite the existing font (wouldn't recommend)
    2. EXPORT AS TTF

    I don't know why but when exporting as otf, the console shows the wrong characters.