How to convert a string containting the hex value of a UTF-8 to a wchar in C? -
i using gcc. have string containing hex value of utf-8 char this:
char[] str = "4e86"
(such kind of strings read out xml-file). convert wchar containing character \u4e86.
i know can directly define
wchar_t wc = l'\u4e86';
but function this
wchar_t wc = convert(str)
how?
try this:
char[] str = "4e86"; wchar_t wc = strtol(str, null, 16);
Comments
Post a Comment