Reputation: 3978
I'm working with ICU in a C++ library. How can I get the Unicode Hex value of a UChar? For example, 'a' should be equal to 0x0041 (http://www.unicode.org/charts/PDF/U0000.pdf).
Upvotes: 1
Views: 163
Reputation: 409166
How about something simple like
std::cout << std::hex << std::setw(4) << std::setfill('0')
<< static_cast<int>('a') << '\n';
Though it prints 0061
and not 0041
, which is the correct hex value for a
.
Upvotes: 2