Mercurial > dwindows
comparison 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 |
comparison
equal
deleted
inserted
replaced
1619:4034562aee7f | 1620:32b5fba0b00a |
---|---|
1279 if ((sfArray = SafeArrayCreate(VT_VARIANT, 1, (SAFEARRAYBOUND *)&ArrayBound))) | 1279 if ((sfArray = SafeArrayCreate(VT_VARIANT, 1, (SAFEARRAYBOUND *)&ArrayBound))) |
1280 { | 1280 { |
1281 if (!SafeArrayAccessData(sfArray, (void**)&pVar)) | 1281 if (!SafeArrayAccessData(sfArray, (void**)&pVar)) |
1282 { | 1282 { |
1283 pVar->vt = VT_BSTR; | 1283 pVar->vt = VT_BSTR; |
1284 #ifndef UNICODE | |
1285 { | 1284 { |
1286 wchar_t *buffer; | 1285 wchar_t *buffer; |
1287 DWORD size; | 1286 DWORD size; |
1288 | 1287 |
1289 size = MultiByteToWideChar(CP_ACP, 0, string, -1, 0, 0); | 1288 size = MultiByteToWideChar(CP_UTF8, 0, string, -1, 0, 0); |
1290 if (!(buffer = (wchar_t *)GlobalAlloc(GMEM_FIXED, sizeof(wchar_t) * size))) goto bad; | 1289 if (!(buffer = (wchar_t *)GlobalAlloc(GMEM_FIXED, sizeof(wchar_t) * size))) goto bad; |
1291 MultiByteToWideChar(CP_ACP, 0, string, -1, buffer, size); | 1290 MultiByteToWideChar(CP_UTF8, 0, string, -1, buffer, size); |
1292 bstr = SysAllocString(buffer); | 1291 bstr = SysAllocString(buffer); |
1293 GlobalFree(buffer); | 1292 GlobalFree(buffer); |
1294 } | 1293 } |
1295 #else | |
1296 bstr = SysAllocString(string); | |
1297 #endif | |
1298 // Store our BSTR pointer in the VARIENT. | 1294 // Store our BSTR pointer in the VARIENT. |
1299 if ((pVar->bstrVal = bstr)) | 1295 if ((pVar->bstrVal = bstr)) |
1300 { | 1296 { |
1301 // Pass the VARIENT with its BSTR to write() in order to shove our desired HTML string | 1297 // Pass the VARIENT with its BSTR to write() in order to shove our desired HTML string |
1302 // into the body of that empty page we created above. | 1298 // into the body of that empty page we created above. |