Commit 32c066f1 authored by Alexander Scott-Johns's avatar Alexander Scott-Johns Committed by Alexandre Julliard

notepad: When opening a file, replace \0 characters with spaces, instead of…

notepad: When opening a file, replace \0 characters with spaces, instead of truncating the file at the first \0.
parent 93b99e0a
...@@ -346,6 +346,7 @@ void DoOpenFile(LPCWSTR szFileName, ENCODING enc) ...@@ -346,6 +346,7 @@ void DoOpenFile(LPCWSTR szFileName, ENCODING enc)
DWORD dwNumRead; DWORD dwNumRead;
int lenW; int lenW;
WCHAR* textW; WCHAR* textW;
int i;
WCHAR log[5]; WCHAR log[5];
/* Close any files and prompt to save changes */ /* Close any files and prompt to save changes */
...@@ -433,6 +434,12 @@ void DoOpenFile(LPCWSTR szFileName, ENCODING enc) ...@@ -433,6 +434,12 @@ void DoOpenFile(LPCWSTR szFileName, ENCODING enc)
} }
} }
/* Replace '\0's with spaces. Other than creating a custom control that
* can deal with '\0' characters, it's the best that can be done.
*/
for (i = 0; i < lenW; i++)
if (textW[i] == '\0')
textW[i] = ' ';
textW[lenW] = '\0'; textW[lenW] = '\0';
if (lenW >= 1 && textW[0] == 0xfeff) if (lenW >= 1 && textW[0] == 0xfeff)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment