From 48c36db40c83de59e660182699dcc7a0e1b22813 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Thu, 6 Nov 2014 15:55:39 +0000 Subject: [PATCH] mlang: Accept "ascii" as an alias for "us-ascii". --- dlls/mlang/mlang.c | 13 ++++++++++++- dlls/mlang/tests/mlang.c | 12 ++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c index e44e8628dd0..8a4e78f34be 100644 --- a/dlls/mlang/mlang.c +++ b/dlls/mlang/mlang.c @@ -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; + } } } diff --git a/dlls/mlang/tests/mlang.c b/dlls/mlang/tests/mlang.c index 1d52af6f483..a840b4a86a3 100644 --- a/dlls/mlang/tests/mlang.c +++ b/dlls/mlang/tests/mlang.c @@ -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); -- 2.11.4.GIT