From fecccc72f69a17274ea8b4ef217aae8577b1ad66 Mon Sep 17 00:00:00 2001 From: Makoto Kato <m_kato@ga2.so-net.ne.jp> Date: Mon, 27 Nov 2017 12:45:14 +0900 Subject: [PATCH] Bug 943272 - Get rid of nsIPlatformCharset. r=emk MozReview-Commit-ID: DVatkTEYA1q --HG-- extra : rebase_source : f95d587d3af94c0e058dde5c98ab917d98fcc48a --- intl/build/nsI18nModule.cpp | 3 - intl/locale/android/moz.build | 1 - intl/locale/android/nsAndroidCharset.cpp | 42 -- intl/locale/mac/moz.build | 1 - intl/locale/mac/nsMacCharset.cpp | 49 -- intl/locale/moz.build | 11 +- intl/locale/nsIPlatformCharset.h | 55 --- intl/locale/nsLocaleConstructors.h | 2 - intl/locale/nsPlatformCharset.h | 34 -- intl/locale/unix/moz.build | 28 -- intl/locale/unix/nsUNIXCharset.cpp | 135 ------ intl/locale/unix/unixcharset.properties | 536 ---------------------- intl/locale/windows/moz.build | 8 - intl/locale/windows/nsWinCharset.cpp | 72 --- intl/locale/windows/wincharset.properties | 23 - 15 files changed, 4 insertions(+), 996 deletions(-) delete mode 100644 intl/locale/android/nsAndroidCharset.cpp delete mode 100644 intl/locale/mac/nsMacCharset.cpp delete mode 100644 intl/locale/nsIPlatformCharset.h delete mode 100644 intl/locale/nsPlatformCharset.h delete mode 100644 intl/locale/unix/moz.build delete mode 100644 intl/locale/unix/nsUNIXCharset.cpp delete mode 100644 intl/locale/unix/unixcharset.properties delete mode 100644 intl/locale/windows/nsWinCharset.cpp delete mode 100644 intl/locale/windows/wincharset.properties diff --git a/intl/build/nsI18nModule.cpp b/intl/build/nsI18nModule.cpp index 076501e61c334..e8649c56384e1 100644 --- a/intl/build/nsI18nModule.cpp +++ b/intl/build/nsI18nModule.cpp @@ -32,7 +32,6 @@ NS_DEFINE_NAMED_CID(NS_WBRK_CID); NS_DEFINE_NAMED_CID(NS_STRINGBUNDLESERVICE_CID); NS_DEFINE_NAMED_CID(NS_STRINGBUNDLETEXTOVERRIDE_CID); NS_DEFINE_NAMED_CID(NS_COLLATIONFACTORY_CID); -NS_DEFINE_NAMED_CID(NS_PLATFORMCHARSET_CID); NS_DEFINE_NAMED_CID(NS_COLLATION_CID); static const mozilla::Module::CIDEntry kIntlCIDs[] = { @@ -43,7 +42,6 @@ static const mozilla::Module::CIDEntry kIntlCIDs[] = { { &kNS_STRINGBUNDLESERVICE_CID, false, nullptr, nsStringBundleServiceConstructor }, { &kNS_STRINGBUNDLETEXTOVERRIDE_CID, false, nullptr, nsStringBundleTextOverrideConstructor }, { &kNS_COLLATIONFACTORY_CID, false, nullptr, nsCollationFactoryConstructor }, - { &kNS_PLATFORMCHARSET_CID, false, nullptr, nsPlatformCharsetConstructor }, { &kNS_COLLATION_CID, false, nullptr, nsCollationConstructor }, { nullptr } }; @@ -56,7 +54,6 @@ static const mozilla::Module::ContractIDEntry kIntlContracts[] = { { NS_STRINGBUNDLE_CONTRACTID, &kNS_STRINGBUNDLESERVICE_CID }, { NS_STRINGBUNDLETEXTOVERRIDE_CONTRACTID, &kNS_STRINGBUNDLETEXTOVERRIDE_CID }, { NS_COLLATIONFACTORY_CONTRACTID, &kNS_COLLATIONFACTORY_CID }, - { NS_PLATFORMCHARSET_CONTRACTID, &kNS_PLATFORMCHARSET_CID }, { NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID }, { nullptr } }; diff --git a/intl/locale/android/moz.build b/intl/locale/android/moz.build index a56081a85078a..bc0563a0c37cb 100644 --- a/intl/locale/android/moz.build +++ b/intl/locale/android/moz.build @@ -5,7 +5,6 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. UNIFIED_SOURCES += [ - 'nsAndroidCharset.cpp', 'OSPreferences_android.cpp' ] diff --git a/intl/locale/android/nsAndroidCharset.cpp b/intl/locale/android/nsAndroidCharset.cpp deleted file mode 100644 index bae0e10d2bedb..0000000000000 --- a/intl/locale/android/nsAndroidCharset.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsIPlatformCharset.h" -#include "nsPlatformCharset.h" - -NS_IMPL_ISUPPORTS(nsPlatformCharset, nsIPlatformCharset) - -nsPlatformCharset::nsPlatformCharset() -{ -} - -nsPlatformCharset::~nsPlatformCharset() -{ -} - -NS_IMETHODIMP -nsPlatformCharset::Init() -{ - return NS_OK; -} - -NS_IMETHODIMP -nsPlatformCharset::GetCharset(nsPlatformCharsetSel selector, nsACString& oResult) -{ - oResult.AssignLiteral("UTF-8"); - return NS_OK; -} - -nsresult -nsPlatformCharset::InitGetCharset(nsACString &oString) -{ - return NS_OK; -} - -nsresult -nsPlatformCharset::VerifyCharset(nsCString &aCharset) -{ - return NS_OK; -} diff --git a/intl/locale/mac/moz.build b/intl/locale/mac/moz.build index 3c317c10bbe7a..6f933e2a5b6c0 100644 --- a/intl/locale/mac/moz.build +++ b/intl/locale/mac/moz.build @@ -5,7 +5,6 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. UNIFIED_SOURCES += [ - 'nsMacCharset.cpp', 'OSPreferences_mac.cpp' ] diff --git a/intl/locale/mac/nsMacCharset.cpp b/intl/locale/mac/nsMacCharset.cpp deleted file mode 100644 index 51bfbb65547e8..0000000000000 --- a/intl/locale/mac/nsMacCharset.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include <Carbon/Carbon.h> -#include "nsIPlatformCharset.h" -#include "nsString.h" -#include "nsPlatformCharset.h" - -NS_IMPL_ISUPPORTS(nsPlatformCharset, nsIPlatformCharset) - -nsPlatformCharset::nsPlatformCharset() -{ -} -nsPlatformCharset::~nsPlatformCharset() -{ -} - -NS_IMETHODIMP -nsPlatformCharset::GetCharset(nsPlatformCharsetSel selector, nsACString& oResult) -{ - oResult.AssignLiteral("UTF-8"); - return NS_OK; -} - -NS_IMETHODIMP -nsPlatformCharset::Init() -{ - return NS_OK; -} - -nsresult -nsPlatformCharset::MapToCharset(nsAString& inANSICodePage, nsACString& outCharset) -{ - return NS_OK; -} - -nsresult -nsPlatformCharset::InitGetCharset(nsACString &oString) -{ - return NS_OK; -} - -nsresult -nsPlatformCharset::VerifyCharset(nsCString &aCharset) -{ - return NS_OK; -} diff --git a/intl/locale/moz.build b/intl/locale/moz.build index 178f999ddd235..6114dd2f01ca7 100644 --- a/intl/locale/moz.build +++ b/intl/locale/moz.build @@ -12,12 +12,10 @@ if toolkit == 'windows': DIRS += ['windows'] elif toolkit == 'cocoa': DIRS += ['mac'] -else: - DIRS += ['unix'] - if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: - DIRS += ['gtk'] - elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': - DIRS += ['android'] +elif 'gtk' in toolkit: + DIRS += ['gtk'] +elif toolkit == 'android': + DIRS += ['android'] XPIDL_SOURCES += [ 'mozILocaleService.idl', @@ -30,7 +28,6 @@ XPIDL_MODULE = 'locale' EXPORTS += [ 'DateTimeFormat.h', 'nsCollationCID.h', - 'nsIPlatformCharset.h', 'nsLanguageAtomService.h', 'nsUConvPropertySearch.h', ] diff --git a/intl/locale/nsIPlatformCharset.h b/intl/locale/nsIPlatformCharset.h deleted file mode 100644 index 6a8e5193d1866..0000000000000 --- a/intl/locale/nsIPlatformCharset.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef nsIPlatformCharset_h__ -#define nsIPlatformCharset_h__ - -#include "nsStringGlue.h" -#include "nsISupports.h" - -// Interface ID for our nsIPlatformCharset interface - -/* 778859d5-fc01-4f4b-bfaa-3c0d1b6c81d6 */ -#define NS_IPLATFORMCHARSET_IID \ -{ 0x778859d5, \ - 0xfc01, \ - 0x4f4b, \ - {0xbf, 0xaa, 0x3c, 0x0d, 0x1b, 0x6c, 0x81, 0xd6} } - -#define NS_PLATFORMCHARSET_CID \ -{ 0x84b0f182, 0xc6c7, 0x11d2, {0xb3, 0xb0, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 }} - -#define NS_PLATFORMCHARSET_CONTRACTID "@mozilla.org/intl/platformcharset;1" - -typedef enum { - kPlatformCharsetSel_PlainTextInClipboard = 0, - kPlatformCharsetSel_FileName = 1, - kPlatformCharsetSel_Menu = 2, - kPlatformCharsetSel_4xBookmarkFile = 3, - kPlatformCharsetSel_KeyboardInput = 4, - kPlatformCharsetSel_WindowManager = 5, - kPlatformCharsetSel_4xPrefsJS = 6, - kPlatformCharsetSel_PlainTextInFile = 7 -} nsPlatformCharsetSel; - -/** - * DO NOT ADD NEW USES OF THIS INTERFACE! - * Removal is https://bugzilla.mozilla.org/show_bug.cgi?id=943272 - * - * Instead, use UTF-16 APIs on Windows and UTF-8 APIs everywhere else. - * Assume plain text files are UTF-8. - */ -class nsIPlatformCharset : public nsISupports -{ -public: - - NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPLATFORMCHARSET_IID) - - NS_IMETHOD GetCharset(nsPlatformCharsetSel selector, nsACString& oResult) = 0; -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIPlatformCharset, NS_IPLATFORMCHARSET_IID) - -#endif /* nsIPlatformCharset_h__ */ diff --git a/intl/locale/nsLocaleConstructors.h b/intl/locale/nsLocaleConstructors.h index b5d27f8f58205..8b55e071cfc8b 100644 --- a/intl/locale/nsLocaleConstructors.h +++ b/intl/locale/nsLocaleConstructors.h @@ -10,7 +10,6 @@ #include "nsCollationCID.h" #include "mozilla/ModuleUtils.h" #include "nsIServiceManager.h" -#include "nsPlatformCharset.h" #include "LocaleService.h" #include "OSPreferences.h" @@ -33,7 +32,6 @@ ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) \ NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollation) NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationFactory) -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPlatformCharset, Init) namespace mozilla { namespace intl { diff --git a/intl/locale/nsPlatformCharset.h b/intl/locale/nsPlatformCharset.h deleted file mode 100644 index 6063c24ff6feb..0000000000000 --- a/intl/locale/nsPlatformCharset.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef nsPlatformCharset_h__ -#define nsPlatformCharset_h__ - -#include "nsIPlatformCharset.h" - -class nsPlatformCharset final : public nsIPlatformCharset -{ - NS_DECL_ISUPPORTS - -public: - - nsPlatformCharset(); - - NS_IMETHOD Init(); - NS_IMETHOD GetCharset(nsPlatformCharsetSel selector, nsACString& oResult) override; - -private: - nsCString mCharset; - nsString mLocale; // remember the locale & charset - - nsresult MapToCharset(nsAString& inANSICodePage, nsACString& outCharset); - nsresult InitGetCharset(nsACString& oString); - nsresult VerifyCharset(nsCString &aCharset); - - virtual ~nsPlatformCharset(); -}; - -#endif // nsPlatformCharset_h__ - - diff --git a/intl/locale/unix/moz.build b/intl/locale/unix/moz.build deleted file mode 100644 index 860256fad39d7..0000000000000 --- a/intl/locale/unix/moz.build +++ /dev/null @@ -1,28 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android': - SOURCES += [ - 'nsUNIXCharset.cpp', - ] - GENERATED_FILES = [ - 'unixcharset.properties.h', - ] - unixcharset = GENERATED_FILES['unixcharset.properties.h'] - unixcharset.script = '../props2arrays.py' - unixcharset.inputs = ['unixcharset.properties'] - -FINAL_LIBRARY = 'xul' - -LOCAL_INCLUDES += [ - '..', -] - -# CODESET is not automatically defined on some older versions of Redhat. -# Define _XOPEN_SOURCE so CODESET will get defined and thus allow -# nl_langinfo(CODESET) to compile on these systems. -if CONFIG['OS_ARCH'] == 'Linux': - DEFINES['_XOPEN_SOURCE'] = 500 diff --git a/intl/locale/unix/nsUNIXCharset.cpp b/intl/locale/unix/nsUNIXCharset.cpp deleted file mode 100644 index 78ca58eda2c97..0000000000000 --- a/intl/locale/unix/nsUNIXCharset.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include <locale.h> - -#include "mozilla/ArrayUtils.h" - -#include "nsIPlatformCharset.h" -#include "nsUConvPropertySearch.h" -#include "nsCOMPtr.h" -#include "nsReadableUtils.h" -#if HAVE_GNU_LIBC_VERSION_H -#include <gnu/libc-version.h> -#endif -#ifdef HAVE_NL_TYPES_H -#include <nl_types.h> -#endif -#if HAVE_LANGINFO_CODESET -#include <langinfo.h> -#endif -#include "nsPlatformCharset.h" -#include "prinit.h" -#include "nsUnicharUtils.h" -#include "mozilla/Encoding.h" - -using namespace mozilla; - -static constexpr nsUConvProp kUnixCharsets[] = { -#include "unixcharset.properties.h" -}; - -NS_IMPL_ISUPPORTS(nsPlatformCharset, nsIPlatformCharset) - -nsPlatformCharset::nsPlatformCharset() -{ -} - -static nsresult -ConvertLocaleToCharsetUsingDeprecatedConfig(const nsACString& locale, - nsACString& oResult) -{ - if (!(locale.IsEmpty())) { - if (NS_SUCCEEDED(nsUConvPropertySearch::SearchPropertyValue(kUnixCharsets, - ArrayLength(kUnixCharsets), locale, oResult))) { - return NS_OK; - } - } - NS_ERROR("unable to convert locale to charset using deprecated config"); - oResult.AssignLiteral("ISO-8859-1"); - return NS_SUCCESS_USING_FALLBACK_LOCALE; -} - -nsPlatformCharset::~nsPlatformCharset() -{ -} - -NS_IMETHODIMP -nsPlatformCharset::GetCharset(nsPlatformCharsetSel selector, nsACString& oResult) -{ - oResult = mCharset; - return NS_OK; -} - -nsresult -nsPlatformCharset::InitGetCharset(nsACString &oString) -{ -#if HAVE_LANGINFO_CODESET - char* nl_langinfo_codeset = nullptr; - nsCString aCharset; - nsresult res; - - nl_langinfo_codeset = nl_langinfo(CODESET); - NS_ASSERTION(nl_langinfo_codeset, "cannot get nl_langinfo(CODESET)"); - - // - // see if we can use nl_langinfo(CODESET) directly - // - if (nl_langinfo_codeset) { - aCharset.Assign(nl_langinfo_codeset); - res = VerifyCharset(aCharset); - if (NS_SUCCEEDED(res)) { - oString = aCharset; - return res; - } - } - - NS_ERROR("unable to use nl_langinfo(CODESET)"); -#endif - - // - // try falling back on a deprecated (locale based) name - // - char* locale = setlocale(LC_CTYPE, nullptr); - nsAutoCString localeStr; - localeStr.Assign(locale); - return ConvertLocaleToCharsetUsingDeprecatedConfig(localeStr, oString); -} - -NS_IMETHODIMP -nsPlatformCharset::Init() -{ - // - // remember default locale so we can use the - // same charset when asked for the same locale - // - char* locale = setlocale(LC_CTYPE, nullptr); - NS_ASSERTION(locale, "cannot setlocale"); - if (locale) { - CopyASCIItoUTF16(locale, mLocale); - } else { - mLocale.AssignLiteral("en_US"); - } - - // InitGetCharset only returns NS_OK or NS_SUCESS_USING_FALLBACK_LOCALE - return InitGetCharset(mCharset); -} - -nsresult -nsPlatformCharset::VerifyCharset(nsCString &aCharset) -{ - // fast path for UTF-8. Most platform uses UTF-8 as charset now. - if (aCharset.EqualsLiteral("UTF-8")) { - return NS_OK; - } - - const Encoding* encoding = Encoding::ForLabelNoReplacement(aCharset); - if (!encoding) { - return NS_ERROR_UCONV_NOCONV; - } - - encoding->Name(aCharset); - return NS_OK; -} diff --git a/intl/locale/unix/unixcharset.properties b/intl/locale/unix/unixcharset.properties deleted file mode 100644 index d62162efc3ae6..0000000000000 --- a/intl/locale/unix/unixcharset.properties +++ /dev/null @@ -1,536 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -## -## NOTE: THIS FILE IS DEPRECATED -## except for those *nix systems that do not support -## nl_langinfo(CODESET) this file should not be used -## -## All platform section -## Put the general locale to charset mapping here. -## If somehow two platform use the same locale name with different -## charset, put the least common one in the platform specific section -## This section have lower priority than the platform specific section -## -## The key is the locale name -# AIX -ar_AA=ISO-8859-6 -# Solaris -Ar_ARM=ISO-8859-6 -american.iso88591=ISO-8859-1 -bulgarian=ISO-8859-2 -bg_BG.ISO8859-5=ISO-8859-5 -# AIX -bg_BG=ISO-8859-5 -C=ISO-8859-1 -# HP -C.iso885915=ISO-8859-15 -c-french.iso88591=ISO-8859-1 -chinese=gb18030 -chinese-s=gb18030 -chinese-t.big5=Big5 -cs=ISO-8859-2 -cs_CZ=ISO-8859-2 -cs_CZ.ISO8859-2=ISO-8859-2 -cs_CZ.88592=ISO-8859-2 -czech=ISO-8859-2 -da=ISO-8859-1 -# Solaris -da.ISO8859-15=ISO-8859-15 -da_DK.ISO8859-15=ISO-8859-15 -da_DK.ISO8859-15@euro=ISO-8859-15 -# Solaris -da.ISO8859-15@euro=ISO-8859-15 -da_DK.88591=ISO-8859-1 -# HP -da_DK.iso885915@euro=ISO-8859-15 -da_DK.ISO8859-1=ISO-8859-1 -da_DK=ISO-8859-1 -# AIX -#Da_DK=IBM-850 -danish.iso88591=ISO-8859-1 -dutch.iso88591=ISO-8859-1 -de=ISO-8859-1 -# Solaris -de.ISO8859-15=ISO-8859-15 -# Solaris -de.ISO8859-15@euro=ISO-8859-15 -# Solaris -de.UTF-8=UTF-8 -# Solaris -de.UTF-8@euro=UTF-8 -de_AT=ISO-8859-1 -# Solaris -de_AT.ISO8859-15=ISO-8859-15 -# Solaris -de_AT.ISO8859-15@euro=ISO-8859-15 -de_CH=ISO-8859-1 -de_CH.88591=ISO-8859-1 -de_CH.ISO8859-1=ISO-8859-1 -de_DE.ISO8859-15=ISO-8859-15 -de_DE.ISO8859-15@euro=ISO-8859-15 -# AIX -#De_CH=IBM-850 -de_DE=ISO-8859-1 -de_DE.88591=ISO-8859-1 -# HP -de_DE.iso885915=ISO-8859-15 -# HP -de_DE.iso885915@euro=ISO-8859-15 -de_DE.ISO8859-1=ISO-8859-1 -# AIX -#De_DE=IBM-850 -# Solaris -el_GR.ISO8859-7=ISO-8859-7 -el_GR.ISO8859-7@euro=ISO-8859-7 -en_AU.ISO8859-1=ISO-8859-1 -en_CA.ISO8859-1=ISO-8859-1 -# AIX -el_GR=ISO-8859-7 -en=ISO-8859-1 -en_AU=ISO-8859-1 -en_CA=ISO-8859-1 -en_GB=ISO-8859-1 -# Solaris -en_GB.ISO8859-15=ISO-8859-15 -# Solaris -en_GB.ISO8859-15@euro=ISO-8859-15 -en_GB.88591=ISO-8859-1 -en_GB.ISO8859-1=ISO-8859-1 -# HP -en_GB.iso885915@euro=ISO-8859-15 -# AIX -#En_GB=IBM-850 -# Solaris -en_IE.ISO8859-1=ISO-8859-1 -en_IE.ISO8859-15=ISO-8859-15 -# Solaris -en_IE.ISO8859-15@euro=ISO-8859-15 -en_JP=EUC-JP -en_JP.IBM-eucJP=EUC-JP -En_JP.IBM-932=Shift_JIS -En_JP=Shift_JIS -en_KR=EUC-KR -en_KR.IBM-eucKR=EUC-KR -en_TH=ISO-8859-1 -en_US=ISO-8859-1 -en_US.88591=ISO-8859-1 -en_US.ISO8859-1=ISO-8859-1 -#FreeBSD -en_US.ISO_8859-1=ISO-8859-1 -da_DK.ISO_8859-1=ISO-8859-1 -de_AT.ISO_8859-1=ISO-8859-1 -de_CH.ISO_8859-1=ISO-8859-1 -de_DE.ISO_8859-1=ISO-8859-1 -en_AU.ISO_8859-1=ISO-8859-1 -en_CA.ISO_8859-1=ISO-8859-1 -en_GB.ISO_8859-1=ISO-8859-1 -es_ES.ISO_8859-1=ISO-8859-1 -fi_FI.ISO_8859-1=ISO-8859-1 -fr_BE.ISO_8859-1=ISO-8859-1 -fr_CA.ISO_8859-1=ISO-8859-1 -fr_CH.ISO_8859-1=ISO-8859-1 -fr_FR.ISO_8859-1=ISO-8859-1 -is_IS.ISO_8859-1=ISO-8859-1 -it_CH.ISO_8859-1=ISO-8859-1 -it_IT.ISO_8859-1=ISO-8859-1 -la_LN.ISO_8859-1=ISO-8859-1 -nl_BE.ISO_8859-1=ISO-8859-1 -nl_NL.ISO_8859-1=ISO-8859-1 -no_NO.ISO_8859-1=ISO-8859-1 -pt_PT.ISO_8859-1=ISO-8859-1 -sv_SE.ISO_8859-1=ISO-8859-1 -# FreeBSD 8859-15 -da_DK.DIS_8859-15=ISO-8859-15 -de_AT.DIS_8859-15=ISO-8859-15 -de_CH.DIS_8859-15=ISO-8859-15 -de_DE.DIS_8859-15=ISO-8859-15 -en_AU.DIS_8859-15=ISO-8859-15 -en_CA.DIS_8859-15=ISO-8859-15 -en_GB.DIS_8859-15=ISO-8859-15 -en_US.DIS_8859-15=ISO-8859-15 -es_ES.DIS_8859-15=ISO-8859-15 -fi_FI.DIS_8859-15=ISO-8859-15 -fr_BE.DIS_8859-15=ISO-8859-15 -fr_CA.DIS_8859-15=ISO-8859-15 -fr_CH.DIS_8859-15=ISO-8859-15 -fr_FR.DIS_8859-15=ISO-8859-15 -is_IS.DIS_8859-15=ISO-8859-15 -it_CH.DIS_8859-15=ISO-8859-15 -it_IT.DIS_8859-15=ISO-8859-15 -la_LN.DIS_8859-15=ISO-8859-15 -nl_BE.DIS_8859-15=ISO-8859-15 -nl_NL.DIS_8859-15=ISO-8859-15 -no_NO.DIS_8859-15=ISO-8859-15 -pt_PT.DIS_8859-15=ISO-8859-15 -sv_SE.DIS_8859-15=ISO-8859-15 -# FreeBSD 8859-2 -cs_CZ.ISO_8859-2=ISO-8859-2 -hr_HR.ISO_8859-2=ISO-8859-2 -hu_HU.ISO_8859-2=ISO-8859-2 -la_LN.ISO_8859-2=ISO-8859-2 -pl_PL.ISO_8859-2=ISO-8859-2 -sl_SI.ISO_8859-2=ISO-8859-2 -# FreeBSD 8859-4 -la_LN.ISO_8859-4=ISO-8859-4 -lt_LT.ISO_8859-4=ISO-8859-4 -# FreeBSD 8859-5 -ru_RU.ISO_8859-5=ISO-8859-5 -ru_SU.ISO_8859-5=ISO-8859-5 -# FreeBSD Russian -ru_SU.KOI8-R=KOI8-R -# FreeBSD Ukrainian -uk_UA.KOI8-U=KOI8-U -# Solaris -en_US.UTF-8=UTF-8 -# Solaris -en_US.UTF-8@euro=UTF-8 -# AIX -#En_US=IBM-850 -english.iso88591=ISO-8859-1 -es=ISO-8859-1 -# Solaris -es.ISO8859-15=ISO-8859-15 -# Solaris -es.ISO8859-15@euro=ISO-8859-15 -# Solaris -es.UTF-8=UTF-8 -# Solaris -es.UTF-8@euro=UTF-8 -es_ES=ISO-8859-1 -es_ES.ISO8859-15=ISO-8859-15 -es_ES.ISO8859-15@euro=ISO-8859-15 -es_AR.ISO8859-1=ISO-8859-1 -es_BO.ISO8859-1=ISO-8859-1 -es_CL.ISO8859-1=ISO-8859-1 -es_CO.ISO8859-1=ISO-8859-1 -es_CR.ISO8859-1=ISO-8859-1 -es_EC.ISO8859-1=ISO-8859-1 -es_GT.ISO8859-1=ISO-8859-1 -es_MX.ISO8859-1=ISO-8859-1 -es_NI.ISO8859-1=ISO-8859-1 -es_PA.ISO8859-1=ISO-8859-1 -es_PE.ISO8859-1=ISO-8859-1 -es_PY.ISO8859-1=ISO-8859-1 -es_SV.ISO8859-1=ISO-8859-1 -es_UY.ISO8859-1=ISO-8859-1 -es_VE.ISO8859-1=ISO-8859-1 -# HP -es_ES.iso885915=ISO-8859-15 -# HP -es_ES.iso885915@euro=ISO-8859-15 -es_ES.88591=ISO-8859-1 -es_ES.ISO8859-1=ISO-8859-1 -# AIX -#En_ES=IBM-850 -# Solaris -et_EE.ISO8859-15=ISO-8859-15 -# AIX -#Et_ET=IBM-922 -# AIX -ET_ET=UTF-8 -fi=ISO-8859-1 -# Solaris -fi.ISO8859-15=ISO-8859-15 -# Solaris -fi.ISO8859-15@euro=ISO-8859-15 -fi_FI=ISO-8859-1 -fi_FI.88591=ISO-8859-1 -fi_FI.ISO8859-1=ISO-8859-1 -fi_FI.ISO8859-15=ISO-8859-15 -fi_FI.ISO8859-15@euro=ISO-8859-15 -# HP -fi_FI.iso885915@euro=ISO-8859-15 -# AIX -#Fi_ES=IBM-850 -finnish.iso88591=ISO-8859-1 -fr=ISO-8859-1 -# Solaris -fr.ISO8859-15=ISO-8859-15 -# Solaris -fr.ISO8859-15@euro=ISO-8859-15 -# Solaris -fr.UTF-8=UTF-8 -# Solaris -fr.UTF-8@euro=UTF-8 -fr_BE=ISO-8859-1 -# Solaris -fr_BE.ISO8859-15=ISO-8859-15 -# Solaris -fr_BE.ISO8859-15@euro=ISO-8859-15 -fr_BE.88591=ISO-8859-1 -fr_BE.ISO8859-1=ISO-8859-1 -fr_BE.iso8859=ISO-8859-1 -# AIX -#Fr_BE=IBM-850 -fr_CA=ISO-8859-1 -fr_CA.88591=ISO-8859-1 -fr_CA.iso8859=ISO-8859-1 -# HP -fr_CA.iso885915@euro=ISO-8859-15 -fr_CA.ISO8859-1=ISO-8859-1 -# AIX -#Fr_CA=IBM-850 -fr_CH=ISO-8859-1 -fr_CH.88591=ISO-8859-1 -fr_CH.iso8859=ISO-8859-1 -fr_CH.ISO8859-1=ISO-8859-1 -# Solaris -fr_FR.ISO8859-15=ISO-8859-15 -fr_FR.ISO8859-15@euro=ISO-8859-15 -# AIX -#Fr_CH=IBM-850 -fr_FR=ISO-8859-1 -fr_FR.88591=ISO-8859-1 -fr_FR.iso8859=ISO-8859-1 -# HP -fr_FR.iso885915=ISO-8859-15 -# HP -fr_FR.iso885915@euro=ISO-8859-15 -fr_FR.ISO8859-1=ISO-8859-1 -# AIX -#Fr_FR=IBM-850 -french.iso88591=ISO-8859-1 -german.iso88591=ISO-8859-1 -# Solaris -he_HE=ISO-8859-8 -he_IL=ISO-8859-8 -hr_HR.ISO8859-2=ISO-8859-2 -# AIX -hr_HR=ISO-8859-2 -hu_HU=ISO-8859-2 -hu_HU.88592=ISO-8859-2 -hu_HU.ISO8859-2=ISO-8859-2 -hungarian=ISO-8859-2 -icelandic.iso88591=ISO-8859-1 -iso_8859_1=ISO-8859-1 -is=ISO-8859-1 -is_IS=ISO-8859-1 -is_IS.88591=ISO-8859-1 -is_IS.ISO8859-1=ISO-8859-1 -# HP -is_IS.iso885915@euro=ISO-8859-15 -# AIX -#Is_IS=IBM-850 -it=ISO-8859-1 -# Solaris -it.ISO8859-15=ISO-8859-15 -# Solaris -it.ISO8859-15@euro=ISO-8859-15 -# Solaris -it.UTF-8=UTF-8 -# Solaris -it.UTF-8@euro=UTF-8 -it_IT.ISO8859-15=ISO-8859-15 -it_IT.ISO8859-15@euro=ISO-8859-15 -# AIX -#It_IT=IBM-850 -italian.iso8859-1=ISO-8859-1 -it_CH=ISO-8859-1 -it_IT=ISO-8859-1 -it_IT.88591=ISO-8859-1 -it_IT.ISO8859-1=ISO-8859-1 -# HP -it_IT.iso885915=ISO-8859-15 -# HP -it_IT.iso885915@euro=ISO-8859-15 -# AIX -iw_IL=ISO-8859-8 -# AIX -#Iw_IL=IBM-856 -ja=EUC-JP -Ja_JP.IBM-932=Shift_JIS -Ja_JP=Shift_JIS -japanese=EUC-JP -japanese.euc=EUC-JP -ja_JP=EUC-JP -# Solaris -ja_JP.UTF-8=UTF-8 -# Solaris -ja_JP.UTF-8@euro=UTF-8 -ja_JP.EUC=EUC-JP -ja_JP.eucJP=EUC-JP -ja_JP.SJIS=Shift_JIS -ja_JP.PCK=Shift_JIS -ja_JP.IBM-eucJP=EUC-JP -ja_JP.mscode=Shift_JIS -ja_JP.ujis=EUC-JP -katakana=Shift_JIS -ko=EUC-KR -ko_KR=EUC-KR -# Solaris -ko_KR.UTF-8=UTF-8 -# Solaris -ko_KR.UTF-8@euro=UTF-8 -ko_KR.euc=EUC-KR -ko_KR.euckr=EUC-KR -ko_KR.eucKR=EUC-KR -ko_KR.IBM-eucKR=EUC-KR -ko_KR.EUC=EUC-KR -ko.UTF-8=UTF-8 -korean=EUC-KR -# Solaris -lt_LT.ISO8859-13=ISO-8859-13 -# AIX -#Lt_LT=IBM-921 -# AIX -LT_LT=UTF-8 -# Solaris -lv_LV.ISO8859-13=ISO-8859-13 -# AIX -#Lt_LV=IBM-921 -# AIX -LT_LV=UTF-8 -# Solaris -mk_MK.ISO8859-5=ISO-8859-5 -# AIX -mk_MK=ISO-8859-5 -nl=ISO-8859-1 -# Solaris -nl.ISO8859-15=ISO-8859-15 -# Solaris -nl.ISO8859-15@euro=ISO-8859-15 -nl_BE=ISO-8859-1 -# Solaris -nl_BE.ISO8859-15=ISO-8859-15 -# Solaris -nl_BE.ISO8859-15@euro=ISO-8859-15 -nl_BE.88591=ISO-8859-1 -nl_BE.ISO8859-1=ISO-8859-1 -# Solaris -nl_NL.ISO8859-15=ISO-8859-15 -nl_NL.ISO8859-15@euro=ISO-8859-15 -# AIX -#NL_BE=IBM-850 -nl_NL=ISO-8859-1 -nl_NL.88591=ISO-8859-1 -nl_NL.ISO8859-1=ISO-8859-1 -# HP -nl_NL.iso885915@euro=ISO-8859-15 -# AIX -#NL_NL=IBM-850 -no=ISO-8859-1 -no_NO=ISO-8859-1 -no_NO.88591=ISO-8859-1 -no_NO.ISO8859-1=ISO-8859-1 -# Solaris -no_NO.ISO8859-1@bokmal=ISO-8859-1 -no_NO.ISO8859-1@nynorsk=ISO-8859-1 -# HP -no_NO.iso885915@euro=ISO-8859-15 -# AIX -#No_NO=IBM-850 -norwegian.iso88591=ISO-8859-1 -pl=ISO-8859-2 -pl_PL=ISO-8859-2 -pl_PL.88592=ISO-8859-2 -pl_PL.ISO8859-2=ISO-8859-2 -polish=ISO-8859-2 -portuguese.iso88591=ISO-8859-1 -pt=ISO-8859-1 -# Solaris -pt.ISO8859-15=ISO-8859-15 -# Solaris -pt.ISO8859-15@euro=ISO-8859-15 -# Solaris -pt_BR.ISO8859-1=ISO-8859-1 -pt_PT.ISO8859-15=ISO-8859-15 -pt_PT.ISO8859-15@euro=ISO-8859-15 -# AIX -#Pt.PT=IBM-850 -pt_PT=ISO-8859-1 -pt_PT.88591=ISO-8859-1 -# HP -pt_PT.iso885915@euro=ISO-8859-15 -pt_PT.ISO8859-1=ISO-8859-1 -# Solaris -ro_RO.ISO8859-2=ISO-8859-2 -# AIX -ro_RO=ISO-8859-5 -# Solaris -#ru_RU.ANSI1251= ??? ANSI-1251 ??? -ru_RU.ISO8859-5=ISO-8859-5 -# AIX -ru_RU=ISO-8859-5 -ru_RU.KOI8-R=KOI8-R -# RedHat 7 reported by Garaschenko Slava <slava@maze.ambernet.kiev.ua bug 70601 -ru_RU.koi8r=KOI8-R -# RedHat 7 reported by Garaschenko Slava <slava@maze.ambernet.kiev.ua bug 70601 -ru_UA=KOI8-U -rumanian=ISO-8859-2 -serbocroatian=ISO-8859-2 -sh=ISO-8859-2 -# Solaris -sh_BA.ISO8859-2@bosnia=ISO-8859-2 -sl_SI.ISO8859-2=ISO-8859-2 -sq_AL.ISO8859-2=ISO-8859-2 -# AIX -sh_SP=ISO-8859-2 -sk=ISO-8859-2 -sk_SK=ISO-8859-2 -sk_SK.88592=ISO-8859-2 -sk_SK.ISO8859-2=ISO-8859-2 -slovene=ISO-8859-2 -spanish.iso88591=ISO-8859-1 -# AIX -sq_AL=ISO-8859-1 -# Solaris -sr_YU.ISO8859-5=ISO-8859-5 -# AIX -sr_SP=ISO-8859-5 -sv=ISO-8859-1 -# Solaris -sv.ISO8859-15=ISO-8859-15 -# Solaris -sv.ISO8859-15@euro=ISO-8859-15 -# Solaris -sv.UTF-8=UTF-8 -# Solaris -sv.UTF-8@euro=UTF-8 -sv_SE=ISO-8859-1 -sv_SE.88591=ISO-8859-1 -sv_SE.ISO8859-15=ISO-8859-15 -sv_SE.ISO8859-15@euro=ISO-8859-15 -# HP -sv_SE.iso885915=ISO-8859-15 -# HP -sv_SE.iso885915@euro=ISO-8859-15 -sv_SE.ISO8859-1=ISO-8859-1 -# AIX -swedish.iso88591=ISO-8859-1 -# Solaris -tr_TR.ISO8859-9=windows-1254 -# AIX -tr_TR=windows-1254 -# Solaris -th_TH=windows-874 -th_TH.TIS620=windows-874 -th=windows-874 -th_TH.UTF-8=UTF-8 -# RedHat 7 reported by Garaschenko Slava <slava@maze.ambernet.kiev.ua bug 70601 -uk_UA=KOI8-U -zh=gb18030 -zh_CN=gb18030 -zh_CN.EUC=gb18030 -zh.GBK=GBK -zh_CN.UTF-8=UTF-8 -zh.UTF-8=UTF-8 -zh_TW.BIG5=Big5 -# saw the following name from news://xcin.linux.org.tw/tlug.cle-devel -zh_CN.gb18030=gb18030 -# AIX -ZH_CN=UTF-8 -zh_CN.ugb=gb18030 -zh_CN.GBK=GBK -zh_HK.big5=Big5 -zh_TW.big5=Big5 -zh_TW.big5@chuyin=Big5 -zh_TW.big5@radical=Big5 -zh_TW.big5@stroke=Big5 -# AIX -Zh_TW.big5=Big5 -# CLE 0.8 -zh_TW.Big5=Big5 -# SunOS 5.7 according to pofeng@linux.org.tw (already above) -# zh_TW.BIG5=Big5 diff --git a/intl/locale/windows/moz.build b/intl/locale/windows/moz.build index 29af4fa326e82..55bf36050e690 100644 --- a/intl/locale/windows/moz.build +++ b/intl/locale/windows/moz.build @@ -5,19 +5,11 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. SOURCES += [ - 'nsWinCharset.cpp', 'OSPreferences_win.cpp' ] FINAL_LIBRARY = 'xul' -GENERATED_FILES = [ - 'wincharset.properties.h', -] -wincharset = GENERATED_FILES['wincharset.properties.h'] -wincharset.script = '../props2arrays.py' -wincharset.inputs = ['wincharset.properties'] - LOCAL_INCLUDES += [ '..', ] diff --git a/intl/locale/windows/nsWinCharset.cpp b/intl/locale/windows/nsWinCharset.cpp deleted file mode 100644 index 6014291a15ea0..0000000000000 --- a/intl/locale/windows/nsWinCharset.cpp +++ /dev/null @@ -1,72 +0,0 @@ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/ArrayUtils.h" - -#include "nsIPlatformCharset.h" -#include "nsUConvPropertySearch.h" -#include <windows.h> -#include "nsString.h" -#include "nsPlatformCharset.h" - -using namespace mozilla; - -static constexpr nsUConvProp kWinCharsets[] = { -#include "wincharset.properties.h" -}; - -NS_IMPL_ISUPPORTS(nsPlatformCharset, nsIPlatformCharset) - -nsPlatformCharset::nsPlatformCharset() -{ - nsAutoString acpKey(NS_LITERAL_STRING("acp.")); - acpKey.AppendInt(int32_t(::GetACP() & 0x00FFFF), 10); - MapToCharset(acpKey, mCharset); -} - -nsPlatformCharset::~nsPlatformCharset() -{ -} - -nsresult -nsPlatformCharset::MapToCharset(nsAString& inANSICodePage, nsACString& outCharset) -{ - nsAutoCString key; - LossyCopyUTF16toASCII(inANSICodePage, key); - - nsresult rv = nsUConvPropertySearch::SearchPropertyValue(kWinCharsets, - ArrayLength(kWinCharsets), key, outCharset); - if (NS_FAILED(rv)) { - outCharset.AssignLiteral("windows-1252"); - return NS_SUCCESS_USING_FALLBACK_LOCALE; - } - return rv; -} - -NS_IMETHODIMP -nsPlatformCharset::GetCharset(nsPlatformCharsetSel selector, - nsACString& oResult) -{ - oResult = mCharset; - return NS_OK; -} - -NS_IMETHODIMP -nsPlatformCharset::Init() -{ - return NS_OK; -} - -nsresult -nsPlatformCharset::InitGetCharset(nsACString &oString) -{ - return NS_OK; -} - -nsresult -nsPlatformCharset::VerifyCharset(nsCString &aCharset) -{ - return NS_OK; -} diff --git a/intl/locale/windows/wincharset.properties b/intl/locale/windows/wincharset.properties deleted file mode 100644 index 79a802492a32c..0000000000000 --- a/intl/locale/windows/wincharset.properties +++ /dev/null @@ -1,23 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file map a ACP to a charset name -# We use this to figure out the charset of file system, clipboard, etc -# - -acp.874=windows-874 -acp.932=Shift_JIS -acp.936=gb18030 -acp.949=EUC-KR -acp.950=Big5 -acp.951=Big5 -acp.1250=windows-1250 -acp.1251=windows-1251 -acp.1252=windows-1252 -acp.1253=windows-1253 -acp.1254=windows-1254 -acp.1255=windows-1255 -acp.1256=windows-1256 -acp.1257=windows-1257 -acp.1258=windows-1258 -- GitLab