I'm linking a text file into my project by adding it to the resource and then loading it.
I use LockResource
and a static_cast
to cast it to a std::wstring
std::wstring sData(static_cast<wchar_t*>(pData));
My project uses UNICODE (windows), which is why I'm using std::wstring
and wchar_t
.
I found out that I have to set the encoding in the file to UCS-2 LE, otherwise it would just read gibberish. I'm guessing this is because that is what encoding Windows uses.
My question is, is it safe to assume all Windows operating systems currently use UCS-2 LE? I don't want to run into a system using UCS-2 BE (or something else). My program would crash horribly.
I could save the file in ANSI, and then convert it to what ever encoding the operating system is using with MultiByteToWideChar
, but this would be a waste of time if it's definitely going to be UCS-2 LE.