notepad: Fix opening Unicode files.

This commit is contained in:
Alexander Nicolaysen Sørnes 2008-07-13 14:08:58 +02:00 committed by Alexandre Julliard
parent d1e02c169d
commit d50e2df17b
1 changed files with 2 additions and 7 deletions

View File

@ -249,13 +249,8 @@ void DoOpenFile(LPCWSTR szFileName)
CloseHandle(hFile);
pTemp[dwNumRead] = 0;
if (IsTextUnicode(pTemp, dwNumRead, NULL))
{
LPWSTR p = (LPWSTR)pTemp;
/* We need to strip BOM Unicode character, SetWindowTextW won't do it for us. */
if (*p == 0xFEFF || *p == 0xFFFE) p++;
SetWindowTextW(Globals.hEdit, p);
}
if((size -1) >= 2 && (BYTE)pTemp[0] == 0xff && (BYTE)pTemp[1] == 0xfe)
SetWindowTextW(Globals.hEdit, (LPWSTR)pTemp + 1);
else
SetWindowTextA(Globals.hEdit, pTemp);