I\'m kind of new to using Unicode string and pointers and I\'ve no idea how the conversion to unicode to ascii and versa-versa works. Following is what I\'m trying
The conversion from ASCII to Unicode and vice versa are quite trivial. By design, the first 128 Unicode values are the same as ASCII (in fact, the first 256 are equal to ISO-8859-1).
So the following code works on systems where char
is ASCII and wchar_t
is Unicode:
const char* ASCII = "Hello, world";
std::wstring Unicode(ASCII, ASCII+strlen(ASCII));
You can't reverse it this simple: 汉 does exist in Unicode but not in ASCII, so how would you "convert" it?