fork(8) download
  1. #include <string>
  2. #include <iostream>
  3. //#include <codecvt>
  4.  
  5. int main() {
  6. //Unicode Character 'LINEAR B SYLLABLE B008 A' (U+10000)
  7. std::string s = "\xF0\x90\x80\x80";
  8. std::cout << s << '\n';
  9. std::wstring_convert<std::codecvt<char16_t,char,std::mbstate_t>,char16_t> convert;
  10. std::u16string u16 = convert.from_bytes(s);
  11. for(int i=0; i<u16.length(); ++i)
  12. std::cout << u16[i];
  13. std::cout << '\n';
  14. std::string u8 = convert.to_bytes(u16);
  15. std::cout << u8 << '\n';
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:9:9: error: 'wstring_convert' is not a member of 'std'
prog.cpp:9:72: error: expected primary-expression before ',' token
prog.cpp:9:73: error: expected primary-expression before 'char16_t'
prog.cpp:9:73: error: expected ';' before 'char16_t'
prog.cpp:10:30: error: 'convert' was not declared in this scope
stdout
Standard output is empty