0

I want to print the musical flat symbol: (U+266D) on a console. I use wchar_t and wprintf() to do that, but it always prints out ? instead of . I tried setmode() and setlocale() as well, as you can see down in the code, but neither of them was successful.

int main(){
    _setmode(_fileno(stdout), _O_U16TEXT);
    //setlocale(LC_ALL, "en_US.UTF-8");

    wprintf(L"\u226d");
}
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Hakura
  • 1
  • 1
    Does the font used in the console support that character? – 1201ProgramAlarm Sep 04 '19 at 04:28
  • Did you have the locale `en_US.UTF-8` installed? Locale names changes between OS and versions of the same OS. Note: UTF-8 is different encoding of O_U16TEXT. So you are using incompatible encodings. Is your console UTF-8 console? It is set to use UTF-8 characters? What about the font? Note: this question is marked duplicate, but if you are not using Windows, you may edit your question and ask to reopen it. – Giacomo Catenazzi Sep 04 '19 at 09:01
  • @GiacomoCatenazzi: Thank you for taking the time and helping me out. This question was marked correctly as a duplicate. I'm still trying to figure out how to change my font to one who supports the flat symbol. I didn't install the local 'en_US.UTF-8', if that is something, you have to install manually. – Hakura Sep 04 '19 at 09:46

0 Answers0