I've written a small C program:
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
int main() {
wprintf(L"%s\n", setlocale(LC_ALL, "C.UTF-8"));
wchar_t chr = L'┐';
wprintf(L"%c\n", chr);
}
Why doesn't this print the character ┐
?
Instead it prints gibberish.
I've checked:
- tried compiling without setlocale, same result
- the terminal itself can print the character, I can copy-paste it to terminal from text-editor, it's gnome-terminal on Ubuntu
- GCC version is 4.8.2
printf
format specifier, which appears to be the correct answer based on your output, you should also ensure that your source file is encoded using UTF-8 rather than something like ISO-8859-15. That sort of thing is why it's better to useL'\u2510'
rather thanL'┐'
. – user539810+
,-
and|
. – Samik