1

I'm new to C++, and I've been having issues with displaying Chinese strings with std::cout in C++. The output is not showing the right characters but instead is showing question marks. I've been searching online for the solution to this problem, but there aren't many methods available, and none of the ones I found seem to work to me.

The following screenshot shows what happens:

screenshot of the problem

My computer is running Windows 10 with system language set to English, Chinese language pack is also installed. The IDE is Visual Studio 2017.

What could be the way to display Chinese output in C++? If C++ is not ideal for displaying non-English language output, what would be a better programming language?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Nosilil
  • 11
  • 1
  • 3
  • 4
    There are TONS of questions on StackOverflow on this very topic. You are saying that you can't make *ANY* of the provided solutions work for you? What *EXACTLY* have you tried that is not working? Did you try using `std::wcout`? Did you try using `WriteConsoleW()`? Did you try putting the console into UTF-8 mode and then write the Chinese text in UTF-8 using `std::cout`? Did you try `imbue`'ing `std::cout` with a UTF-8 locale? There are MANY different options available when it comes to console output, did you try *ANY* of them? – Remy Lebeau Jan 17 '18 at 20:04
  • Maybe consider using a library like Qt which in many cases makes internationalisation easier (mainly through its QString type). – Jesper Juhl Jan 17 '18 at 20:23
  • This can also help: https://stackoverflow.com/questions/48221040/why-do-character-arrays-accept-non-ascii-characters-in-c/48221666#48221666 – FrankS101 Jan 17 '18 at 21:57

0 Answers0