mshtml: Use proper codepage in nsIIOService::NewURI.
This commit is contained in:
parent
d165c05f27
commit
0d023f1968
|
@ -35,6 +35,7 @@
|
|||
#include "optary.h"
|
||||
#include "rpcproxy.h"
|
||||
#include "shlguid.h"
|
||||
#include "mlang.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
|
@ -50,6 +51,35 @@ DWORD mshtml_tls = TLS_OUT_OF_INDEXES;
|
|||
static HINSTANCE shdoclc = NULL;
|
||||
static HDC display_dc;
|
||||
static WCHAR *status_strings[IDS_STATUS_LAST-IDS_STATUS_FIRST+1];
|
||||
static IMultiLanguage2 *mlang;
|
||||
|
||||
UINT cp_from_charset_string(BSTR charset)
|
||||
{
|
||||
MIMECSETINFO info;
|
||||
HRESULT hres;
|
||||
|
||||
if(!mlang) {
|
||||
IMultiLanguage2 *new_mlang;
|
||||
|
||||
hres = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IMultiLanguage2, (void**)&new_mlang);
|
||||
if(FAILED(hres)) {
|
||||
ERR("Could not create CMultiLanguage instance\n");
|
||||
return CP_UTF8;
|
||||
}
|
||||
|
||||
if(InterlockedCompareExchangePointer((void**)&mlang, new_mlang, NULL))
|
||||
IMultiLanguage2_Release(new_mlang);
|
||||
}
|
||||
|
||||
hres = IMultiLanguage2_GetCharsetInfo(mlang, charset, &info);
|
||||
if(FAILED(hres)) {
|
||||
FIXME("GetCharsetInfo failed: %08x\n", hres);
|
||||
return CP_UTF8;
|
||||
}
|
||||
|
||||
return info.uiInternetEncoding;
|
||||
}
|
||||
|
||||
static void thread_detach(void)
|
||||
{
|
||||
|
@ -83,6 +113,8 @@ static void process_detach(void)
|
|||
TlsFree(mshtml_tls);
|
||||
if(display_dc)
|
||||
DeleteObject(display_dc);
|
||||
if(mlang)
|
||||
IMultiLanguage2_Release(mlang);
|
||||
|
||||
free_strings();
|
||||
}
|
||||
|
|
|
@ -1195,6 +1195,7 @@ static inline void windowref_release(windowref_t *ref)
|
|||
heap_free(ref);
|
||||
}
|
||||
|
||||
UINT cp_from_charset_string(BSTR) DECLSPEC_HIDDEN;
|
||||
HDC get_display_dc(void) DECLSPEC_HIDDEN;
|
||||
HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN;
|
||||
void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -3317,6 +3317,7 @@ static nsresult NSAPI nsIOService_NewURI(nsIIOService *iface, const nsACString *
|
|||
WCHAR new_spec[INTERNET_MAX_URL_LENGTH];
|
||||
HTMLOuterWindow *window = NULL;
|
||||
const char *spec = NULL;
|
||||
UINT cp = CP_UTF8;
|
||||
IUri *urlmon_uri;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
|
@ -3343,10 +3344,22 @@ static nsresult NSAPI nsIOService_NewURI(nsIIOService *iface, const nsACString *
|
|||
}
|
||||
}
|
||||
|
||||
if(aOriginCharset && strcasecmp(aOriginCharset, "utf-8"))
|
||||
FIXME("Unsupported charset %s\n", debugstr_a(aOriginCharset));
|
||||
if(aOriginCharset && *aOriginCharset && strncasecmp(aOriginCharset, "utf", 3)) {
|
||||
BSTR charset;
|
||||
int len;
|
||||
|
||||
MultiByteToWideChar(CP_UTF8, 0, spec, -1, new_spec, sizeof(new_spec)/sizeof(WCHAR));
|
||||
len = MultiByteToWideChar(CP_UTF8, 0, aOriginCharset, -1, NULL, 0);
|
||||
charset = SysAllocStringLen(NULL, len-1);
|
||||
if(!charset)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
MultiByteToWideChar(CP_UTF8, 0, aOriginCharset, -1, charset, len);
|
||||
|
||||
cp = cp_from_charset_string(charset);
|
||||
|
||||
SysFreeString(charset);
|
||||
}
|
||||
|
||||
MultiByteToWideChar(cp, 0, spec, -1, new_spec, sizeof(new_spec)/sizeof(WCHAR));
|
||||
|
||||
if(base_wine_uri) {
|
||||
hres = combine_url(base_wine_uri->uri, new_spec, &urlmon_uri);
|
||||
|
|
Loading…
Reference in New Issue