Advertisement
DmitryPythonDevelop

Untitled

Apr 4th, 2020
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <string>
  2. #include <cstring>
  3. #include <iostream>
  4. #include <windows.h>
  5.  
  6. int main(void)
  7. {
  8. // use utf8 literal
  9. std::string test = u8"1°à€3§4ç5@の,は,でした,象形字 ;";
  10.  
  11. // set code page to utf8
  12. SetConsoleOutputCP(CP_UTF8);
  13.  
  14. // Enable buffering to prevent VS from chopping up UTF-8 byte sequences
  15. setvbuf(stdout, nullptr, _IOFBF, 1000);
  16.  
  17. // printing std::string to std::cout, not std::wstring to std::wcout
  18. std::cout << test << std::endl;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement