How to convert a unicode charactor array back to unicode sequence in C++

Posted by eddyxd on Stack Overflow See other posts from Stack Overflow or by eddyxd
Published on 2011-01-01T13:38:26Z Indexed on 2011/01/01 13:54 UTC
Read the original article Hit count: 293

Filed under:
|
|

My problem is how to convert a c/c++ string/chractor array to another string contain the unicode(UTF-16) escape sequence of original one

for example, I want to find a function F(char *ch) could do following function.

char a[10] = "\u5f53";
printf("a = %s\n",a);
char b[10];
b = F(a);   //<- F is the function I wanted
printf("b = %s\n",b);

-------- console will show -------
a = ?
b = \u5f53

Anyone has any Idea@@?~

thanks!!

ps: I tried to guess \u5f35 means the value store in a, but it is not indeed the value of a[0] = -79 , a[1] = 105 ... So I don't know how to convert it back to the sequence of unicode.... Please give me a hane~ : )

© Stack Overflow or respective owner

Related posts about c

    Related posts about unicode