fork(2) download
  1. #include <iostream>
  2. #include <string>
  3. #include <locale>
  4. #include <codecvt>
  5. using namespace std;
  6.  
  7. int main() {
  8. string us = u8"pi: \u03c0"; // 70 69 3a 20 cf 80
  9. cout << us << endl;
  10. cout << u'\u03c0' << endl;
  11. cout << u'\U0001d11e' << endl;
  12.  
  13. wstring_convert<codecvt_utf8<wchar_t>> myconv;
  14. string mbstring = myconv.to_bytes(L"Hello");
  15. cout << mbstring << endl;
  16.  
  17. wstring_convert<codecvt_utf8<uchar16_t>> myconv2;
  18. string mbstring2 = myconv.to_bytes(u"pi: \u03c0");
  19. cout << mbstring2 << endl;
  20.  
  21. }
  22.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:4:19: fatal error: codecvt: No such file or directory
compilation terminated.
stdout
Standard output is empty