I'm trying to print the Unicode value of a wide character like so:
wchar_t w = '\u00A1'; // U+00A1 Inverted Exclamation Mark ¡
wprintf("U+%.4x",w); // prints U+00a1
I'd like the output to be U+00A1
instead of U+00a1
. Is there a printf
specifier to do this or will I have to do it manually?
Guess that was pretty simple, use %X
instead of %x
.
wchar_t w = '\u00A1'; // U+00A1 Inverted Exclamation Mark ¡
wprintf("U+%.4x",w); // prints U+00A1
Thanks, Weather Vane and Some programmer dude and Felix Palmen.