mlang: Accept "ascii" as an alias for "us-ascii".

This commit is contained in:
Huw Davies 2014-11-06 15:55:39 +00:00 committed by Alexandre Julliard
parent 3069e0c0a1
commit 48c36db40c
2 changed files with 24 additions and 1 deletions

View File

@ -65,6 +65,7 @@ typedef struct
const char *web_charset;
const char *header_charset;
const char *body_charset;
const WCHAR *alias;
} MIME_CP_INFO;
/* These data are based on the codepage info in libs/unicode/cpmap.pl */
@ -363,6 +364,9 @@ static const MIME_CP_INFO vietnamese_cp[] =
MIMECONTF_MIME_LATEST,
"windows-1258", "windows-1258", "windows-1258" }
};
static const WCHAR asciiW[] = {'a','s','c','i','i',0};
static const MIME_CP_INFO western_cp[] =
{
{ "IBM EBCDIC (US-Canada)",
@ -415,7 +419,7 @@ static const MIME_CP_INFO western_cp[] =
20127, MIMECONTF_MAILNEWS | MIMECONTF_IMPORT | MIMECONTF_EXPORT |
MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_VALID |
MIMECONTF_VALID_NLS | MIMECONTF_MIME_LATEST,
"us-ascii", "us-ascii", "us-ascii" },
"us-ascii", "us-ascii", "us-ascii", asciiW },
{ "Western European (ISO)",
28591, MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_IMPORT |
MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER |
@ -2600,6 +2604,13 @@ static HRESULT WINAPI fnIMultiLanguage3_GetCharsetInfo(
strcpyW(pCharsetInfo->wszCharset, csetW);
return S_OK;
}
if (mlang_data[i].mime_cp_info[n].alias && !lstrcmpiW(Charset, mlang_data[i].mime_cp_info[n].alias))
{
pCharsetInfo->uiCodePage = mlang_data[i].family_codepage;
pCharsetInfo->uiInternetEncoding = mlang_data[i].mime_cp_info[n].cp;
strcpyW(pCharsetInfo->wszCharset, mlang_data[i].mime_cp_info[n].alias);
return S_OK;
}
}
}

View File

@ -696,6 +696,17 @@ static void test_EnumCodePages(IMultiLanguage2 *iML2, DWORD flags)
IEnumCodePage_Release(iEnumCP);
}
static void test_GetCharsetInfo_alias(IMultiLanguage *ml)
{
WCHAR asciiW[] = {'a','s','c','i','i',0};
MIMECSETINFO info;
HRESULT hr;
hr = IMultiLanguage_GetCharsetInfo(ml, asciiW, &info);
ok(hr == S_OK, "got %08x\n", hr);
ok(!lstrcmpW(info.wszCharset, asciiW), "got %s\n", wine_dbgstr_w(info.wszCharset));
}
static void scriptinfo_cmp(SCRIPTINFO *sinfo1, SCRIPTINFO *sinfo2)
{
ok(sinfo1->ScriptId == sinfo2->ScriptId, "ScriptId mismatch: %d != %d\n", sinfo1->ScriptId, sinfo2->ScriptId);
@ -2000,6 +2011,7 @@ START_TEST(mlang)
test_GetNumberOfCodePageInfo((IMultiLanguage2 *)iML);
test_IMLangConvertCharset(iML);
test_GetCharsetInfo_alias(iML);
IMultiLanguage_Release(iML);