A program in C++ needs to read a file that is encoded in utf-8. Unfortunately, using char* it cannot get extended characters (☺☻♥♦•◘ and so on), and wchar_t* interprets them wrongly. My algorithm to manage it is:
1) Make a new file
2) Name it to [original name]Utf-16
3) Copy original file to new, making a conversion simultaneously
4) Extract data.
5) Delete this temporary file when it’s no longer needed.
I’m stuck at 3), is there somewhere a function like “FileUTF8toUTF16”?
This is what I use
In which
pDatais aBYTEpointer to the actual utf-8 data,nOffsetis usually 3 (the BOM).