Alexander Nicolaysen Sørnes : notepad: Fix opening Unicode files.

Alexandre Julliard julliard at winehq.org
Mon Jul 14 05:57:11 CDT 2008


Module: wine
Branch: master
Commit: d50e2df17baaf6602db980b19ef4e7f3f5c769a1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d50e2df17baaf6602db980b19ef4e7f3f5c769a1

Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date:   Sun Jul 13 14:08:58 2008 +0200

notepad: Fix opening Unicode files.

---

 programs/notepad/dialog.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/programs/notepad/dialog.c b/programs/notepad/dialog.c
index f326906..716abd8 100644
--- a/programs/notepad/dialog.c
+++ b/programs/notepad/dialog.c
@@ -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);
 




More information about the wine-cvs mailing list