When I print out \u2587, it prints out the character I want it to, but when I assign that to a wchar_t, and print that out. It prints some something else.
1 2
wchar_t test = L'\u2587';
cout << "\u2587 " << test << endl;
The output is fine of the first, but its prints the following number 9607 when printing out the variable
IIIRC It should be [code]wchar_t const *test = L"\u2587"[code]. Unicode isn't a single character but instead a wide string. Anyways you probably got a warning message like 7:18: warning: multi-character character constant [-Wmultichar] Either way look at how you ouput on line 2 then how you assign on line 1.
If you are using a C++11 compiler, stick to u8 strings, and make sure your terminal can handle them. (They do by default in *nix. On Windows it takes a little bit of magic.)
The second string literal (the one being sent directly to cout) is being transformed into something useful. The wchar_t, however, is not, because the default locale facet for cout just calls narrow() on your wide-char, and all that does (by default) is truncate the value to the lower 7 (or 8, depending on your compiler) bits.