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 so=u8"Jérôme Ângle"; // é = &#233; ô=&#244; Â = &#194 see http://w...content-available-to-author-only...e.net/unicodecharacters
  9. cout << so<<endl;
  10. wstring st;
  11. wstring_convert<std::codecvt_utf8<wchar_t>,wchar_t> converter;
  12. st = converter.from_bytes(so);
  13. for (auto wc:st)
  14. cout << (unsigned)wc <<" ";
  15. cout<<endl;
  16. char p[]=u8"Jérôme Ângle";
  17. wstring ws = converter.from_bytes(p);
  18. for (auto wc:ws)
  19. cout << (unsigned)wc <<" ";
  20. cout<<endl;
  21.  
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Jérôme Ângle
74 233 114 244 109 101 32 194 110 103 108 101 
74 233 114 244 109 101 32 194 110 103 108 101