My code is basically like this:
wstring japan = L"ζ₯ζ¬"; wstring message = L"Welcome! Japan is "; message += japan; wprintf(message.c_str());
I want to use wide strings, but I don't know how they are output, so I used wprintf. When I run something like:
./widestr | hexdump
Heterodical code points create this:
65 57 63 6c 6d 6f 21 65 4a 20 70 61 6e 61 69 20 20 73 3f 3f e W clmo ! e J panais ? ?
Why are they all bouncing around? I mean, if wprintf is wrong, I still donβt understand why it would issue in such a specific messy order!
edit: endianness or something else? they seem to rotate every two characters. Yes.
EDIT 2: I tried using wcout, but it outputs exactly the same hexadecimal code points. Weird!
c ++ string unicode widechar
John D.
source share