You can use MultiByteToWideChar
WinAPI function, below is example code.
int UTF8toUTF16(const CHAR* utf8, WCHAR* utf16) {
int len = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, NULL, 0);
if (utf16 == NULL)
return len;
if (len>1) {
return MultiByteToWideChar(CP_UTF8, 0, utf8, -1, utf16, len);
}
return 0;
}
const CHAR* utf8str = "someutf8string";
int requiredLen = UTF8toUTF16(utf8str, nullptr);
if (requiredLen > 0) {
std::vector<WCHAR> utf16str(requiredLen, '\0');
UTF8toUTF16(utf8str.data(), &utf16str.front());
// do something with data
}
if you numbers are plain ASCII then of course this conversion will do nothing, but if your requirement says text on input is in UTF8 then to be safe you should do such conversion, at least I would do it.
for further conversion look into here : atoi() with other languages