Chromium Code Reviews| Index: chrome/browser/autofill/autofill_country.cc |
| diff --git a/chrome/browser/autofill/autofill_country.cc b/chrome/browser/autofill/autofill_country.cc |
| index 7cc8a45b6a949e03be8aed391c997a63bcc7225b..44982e32130cedb89d7953d4e7461f24e281a421 100644 |
| --- a/chrome/browser/autofill/autofill_country.cc |
| +++ b/chrome/browser/autofill/autofill_country.cc |
| @@ -386,8 +386,14 @@ const std::string AutofillCountry::CountryCodeForLocale( |
| // Extract the country code. |
| std::string country_code = icu::Locale(likely_locale.c_str()).getCountry(); |
| - // Default to the United States if we have no better guess. |
| - return !country_code.empty() ? country_code : "US"; |
| + // Default to the United States if we have no better guess. Consider the |
| + // country code invalid if it is empty or contains any character other |
| + // than A-Z. |
| + if (country_code.empty() || |
| + country_code.find_first_not_of("ABCDEFGHIJKLMNOPQRSTUVWXYZ") != |
| + std::string::npos) |
|
Ilya Sherman
2011/03/08 10:35:18
Probably the right check here is actually to see i
satorux1
2011/03/08 11:28:10
Done.
|
| + return "US"; |
| + return country_code; |
| } |
| // static |