summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjungshik@google.com <jungshik@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-11 04:22:48 +0000
committerjungshik@google.com <jungshik@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-11 04:22:48 +0000
commit89bf2f07a135b6f6e4c8734ca41051746b9c0930 (patch)
tree8fd2de20b9c45c3a5846af62d85e0c475d3a6f9e
parentc4809365dfd6778a5055370a57494c1d2dca9b97 (diff)
downloadchromium_src-89bf2f07a135b6f6e4c8734ca41051746b9c0930.zip
chromium_src-89bf2f07a135b6f6e4c8734ca41051746b9c0930.tar.gz
chromium_src-89bf2f07a135b6f6e4c8734ca41051746b9c0930.tar.bz2
Fix IDNtoUnicode and unittest.
1. Check whether uloc_getdata returns the default locale because an invalid or unsupported (not a part of ICU data file we use) locale is passed. 2. Replace 'se' with 'sv' in IDNToUnicode test and change the corresponding test result to true. U+00C4 IS used in Swedish, but the result was set to false because the test results were machine generated with the same typo ('se' in place of 'sv') under en_US.UTF-8 locale on Linux and we ran this test only on Windows with en_US locale. 1st part of patch is by Matthias Reitinger <reimarvin@gmail.com> BUG=1153 TEST=NetUtilTest.IDNToUnicode passes in various locales, C, en_US, en_US.utf8, ja_JP.utf8, sv_SE.utf8, hi_IN.utf8, ru_RU.utf8, fr_CA Review URL: http://codereview.chromium.org/1655 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2052 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--AUTHORS1
-rw-r--r--net/base/net_util.cc9
-rw-r--r--net/base/net_util_unittest.cc4
3 files changed, 10 insertions, 4 deletions
diff --git a/AUTHORS b/AUTHORS
index 0689f74..5354fdb 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -10,3 +10,4 @@ Jesse Miller <jesse@jmiller.biz>
Szymon Piechowicz <szymonpiechowicz@o2.pl>
James Vega <vega.james@gmail.com>
Marco Rodrigues <gothicx@gmail.com>
+Matthias Reitinger <reimarvin@gmail.com>
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index 2064af7..d3075ad 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -541,7 +541,13 @@ bool IsIDNComponentSafe(const char16* str,
status = U_ZERO_ERROR;
// TODO(jungshik) Cache exemplar sets for locales.
ULocaleData* uld = ulocdata_open(lang.c_str(), &status);
- if (U_SUCCESS(status)) {
+ // TODO(jungshik) Turn this check on when the ICU data file is
+ // rebuilt with the minimal subset of locale data for languages
+ // to which Chrome is not localized but which we offer in the list
+ // of languages selectable for Accept-Languages. With the rebuilt ICU
+ // data, ulocdata_open never should fall back to the default locale. (issue 2078)
+ // DCHECK(U_SUCCESS(status) && status != U_USING_DEFAULT_WARNING);
+ if (U_SUCCESS(status) && status != U_USING_DEFAULT_WARNING) {
// Should we use auxiliary set, instead?
ulocdata_getExemplarSet(uld, lang_set, 0, ULOCDATA_ES_STANDARD, &status);
ulocdata_close(uld);
@@ -908,4 +914,3 @@ bool IsPortAllowedByFtp(int port) {
}
} // namespace net
-
diff --git a/net/base/net_util_unittest.cc b/net/base/net_util_unittest.cc
index 954afad..22fb7d4 100644
--- a/net/base/net_util_unittest.cc
+++ b/net/base/net_util_unittest.cc
@@ -38,7 +38,7 @@ struct FileNameCDCase {
const wchar_t* kLanguages[] = {
L"", L"en", L"zh-CN", L"ja", L"ko",
L"he", L"ar", L"ru", L"el", L"fr",
- L"de", L"pt", L"se", L"th", L"hi",
+ L"de", L"pt", L"sv", L"th", L"hi",
L"de,en", L"el,en", L"zh,zh-TW,en", L"ko,ja", L"he,ru,en",
L"zh,ru,en"
};
@@ -395,7 +395,7 @@ TEST(NetUtilTest, IDNToUnicode) {
{"www.xn--frgbolaget-q5a.se", L"www.f\x00e4rgbolaget.se",
{true, false, false, false, false,
false, false, false, false, false,
- true, false, false, false, false,
+ true, false, true, false, false,
true, false, false, false, false,
false}},
// c-cedilla (French)