I want to display the hex values for a string of chinese characters in the console.
I'm using visual studio 2010 c++ in windows 7.
So far I have managed to display the hex values for single chinese characters e.g.
1 2 3 4 5 6 7 8 9 10 11
#include <iostream>
#include <string>
#include <stdio.h>
usingnamespace std;
int main ()
{
wchar_t chi = L'您';
printf("%X",chi);
}
which displays the correct hex value of the chinese character (60A8).
However, I need to be able to display multiple hex values corresponding to their chinese characters.
For example, the chinese string "你好世界" should display hex "60A8 597D 4E16 754C".
I've tried looking into using wstring, but I come out with one hex value that has no relevance. I don't know if it's something I'm doing wrong or if I'm just going the wrong way about it.