I wrote this code to print a UTF-8 multibyte string. But it does not print properly. Note: I am doing it in a Linux system.
#include #include <
Use \u instead of \x:
\u
\x
#include #include int main() { char *locale = setlocale(LC_ALL, ""); printf("\n locale =%s\n", locale); printf("test\n \u263a\u263b Hello from C\n"); return 0; }
This runs and produces the following output:
$ gcc foo.c $ ./a.out locale =C test ☺☻ Hello from C