J
Jared Wiltshire
I'm trying to convert a wstring (actually a BSTR) to UTF-8.
This is what I've currently got:
size_t arraySize;
setlocale(LC_CTYPE,"C-UTF-8");
arraySize = wcstombs(NULL, wstr, 0);
char utf8string[arraySize + 1];
wcstombs(utf8string, Name, arraySize + 1);
The problem is that this doesnt seem to convert to UTF-8, it just does
the same as when the setlocale line isnt there.
I've also tried "en_US.UTF-8" instead of "C-UTF-8", but that doesnt
seem to work either.
I'm using Mingw (the version that comes with the latest Dev-C++).
Does anyone know how to make this work?
This is what I've currently got:
size_t arraySize;
setlocale(LC_CTYPE,"C-UTF-8");
arraySize = wcstombs(NULL, wstr, 0);
char utf8string[arraySize + 1];
wcstombs(utf8string, Name, arraySize + 1);
The problem is that this doesnt seem to convert to UTF-8, it just does
the same as when the setlocale line isnt there.
I've also tried "en_US.UTF-8" instead of "C-UTF-8", but that doesnt
seem to work either.
I'm using Mingw (the version that comes with the latest Dev-C++).
Does anyone know how to make this work?