Commit 9c30db38 authored by roubert@google.com's avatar roubert@google.com

Use the root locale instead of the system default locale.

ChromeStringCanonicalizer does case and diacritic insensitive string
comparison through an ICU Collator. To get general Unicode character
rules, the root locale should be used. The system default locale is
different from system to system, and using that will cause the code to
break when executed on a system where it doesn't have the properties
that this code assumes.

This change also adds #include statemens for all ICU header files from
which the code in this file uses declarations.

R=rouslan@chromium.org
BUG=

Review URL: https://codereview.chromium.org/275913002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269601 0039d316-1c4b-4281-b951-d872f2087c98
parent 93fb8d62
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
#include "base/logging.h" #include "base/logging.h"
#include "cpp/include/libaddressinput/util/scoped_ptr.h" #include "cpp/include/libaddressinput/util/scoped_ptr.h"
#include "third_party/icu/source/common/unicode/errorcode.h"
#include "third_party/icu/source/common/unicode/locid.h"
#include "third_party/icu/source/common/unicode/unistr.h"
#include "third_party/icu/source/common/unicode/utypes.h"
#include "third_party/icu/source/i18n/unicode/coll.h" #include "third_party/icu/source/i18n/unicode/coll.h"
namespace i18n { namespace i18n {
...@@ -17,7 +21,9 @@ class ChromeStringCanonicalizer : public StringCanonicalizer { ...@@ -17,7 +21,9 @@ class ChromeStringCanonicalizer : public StringCanonicalizer {
public: public:
ChromeStringCanonicalizer() ChromeStringCanonicalizer()
: error_code_(U_ZERO_ERROR), : error_code_(U_ZERO_ERROR),
collator_(icu::Collator::createInstance(error_code_)) { collator_(
icu::Collator::createInstance(
icu::Locale::getRoot(), error_code_)) {
collator_->setStrength(icu::Collator::PRIMARY); collator_->setStrength(icu::Collator::PRIMARY);
DCHECK(U_SUCCESS(error_code_)); DCHECK(U_SUCCESS(error_code_));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment