Last active
September 30, 2020 08:12
-
-
Save EmmanuelOga/1f48bb73d70f17b3d970d464eea30cb6 to your computer and use it in GitHub Desktop.
State of the art in printing unicode characters to the console on Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/nowide/iostream.hpp> | |
#include <boost/nowide/convert.hpp> | |
using namespace std; | |
namespace nw = boost::nowide; | |
int main() | |
{ | |
string str{ "书中自有黄金屋\n" }; | |
nw::cout << str; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: doesn't work on cmd.exe :-( (even with _set_mode). The only way I found was to change code page to 936 (
chcp 936
).Windows terminal does behave in the expected way.
Good news! It seems like Windows Terminal (which doesn't exhibit the code page issue) may become the default terminal... by 2021...
microsoft/terminal#492 (comment)