diff win/browser.c @ 1620:32b5fba0b00a

Must convert from UTF8 for the raw HTML on Windows regardless of the ANSI/UNICODE mode. This fixes incorrect encoding on raw HTML widgets. Also need to use the ANSI version of GetModuleFileName when converting the command line parameters, or maybe convert to UTF8?
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 27 Mar 2012 15:09:52 +0000
parents 412af8059331
children 417176df4755
line wrap: on
line diff
--- a/win/browser.c	Tue Mar 27 14:51:24 2012 +0000
+++ b/win/browser.c	Tue Mar 27 15:09:52 2012 +0000
@@ -1281,20 +1281,16 @@
 					if (!SafeArrayAccessData(sfArray, (void**)&pVar))
 					{
 						pVar->vt = VT_BSTR;
-#ifndef UNICODE
 						{
-						wchar_t		*buffer;
-						DWORD		size;
+							wchar_t		*buffer;
+							DWORD		size;
 
-						size = MultiByteToWideChar(CP_ACP, 0, string, -1, 0, 0);
-						if (!(buffer = (wchar_t *)GlobalAlloc(GMEM_FIXED, sizeof(wchar_t) * size))) goto bad;
-						MultiByteToWideChar(CP_ACP, 0, string, -1, buffer, size);
-						bstr = SysAllocString(buffer);
-						GlobalFree(buffer);
+							size = MultiByteToWideChar(CP_UTF8, 0, string, -1, 0, 0);
+							if (!(buffer = (wchar_t *)GlobalAlloc(GMEM_FIXED, sizeof(wchar_t) * size))) goto bad;
+							MultiByteToWideChar(CP_UTF8, 0, string, -1, buffer, size);
+							bstr = SysAllocString(buffer);
+							GlobalFree(buffer);
 						}
-#else
-						bstr = SysAllocString(string);
-#endif
 						// Store our BSTR pointer in the VARIENT.
 						if ((pVar->bstrVal = bstr))
 						{