I have the following. It shows up correctly in Microsoft NotePad. It does not show up correctly in Microsoft Wordpad.
Using CodeBlocks 17.12 / MinGW with GCC 5.1 / 32 bit Microsoft Windows XP Pro sp2.
__________
When I open the txt file with Apache OpenOffice Writer 4 I get :
h#e#l#l#o# #-# #J# #-# #S0�0k0a0o0 #-# #a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y#
WRONG and Not usable.
And why all the # ? Why not just give me the Unicode text correctly?
__________
When I open the txt file with Microsoft Notepad I get :
hello - J - こんにちは - abcdefghijklmnopqrstuvwxy
RIGHT and Usable.
My code:
What I have tried:
What I have tried:
HANDLE hDFile = CreateFile(L"utf8_UsingByteOrderMark_C_天堂.txt", GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
DWORD NumberOfBytesWritten;
BOOL bErr = 0;
unsigned char BOM[3]{ 0xef, 0xbb, 0xbf };
bErr = WriteFile(hFile, (LPCVOID)BOM, (DWORD)sizeof(BOM), &dwBytesWritten, NULL);
bErr = WriteFile(hDFile, L"hello - J - こんにちは - abcdefghijklmnopqrstuvwxyz", 90, &NumberOfBytesWritten, NULL);
CloseHandle(hDFile);