fork(5) download
  1. #include <stdlib.h>
  2. #include <locale.h>
  3. #include <stdio.h>
  4. int main()
  5. {
  6. setlocale(LC_ALL, "en_US.utf8"); // or any other utf8 locale
  7. wchar_t c = L'\u00a1'; // or = L'\xa1';
  8. char mb[MB_CUR_MAX + 1];
  9. int len = wctomb(mb, c);
  10. mb[len] = '\0';
  11. printf("UTF-8 char: %s\n", mb);
  12. }
  13.  
Success #stdin #stdout 0.01s 3932KB
stdin
Standard input is empty
stdout
UTF-8 char: ¡