summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
authorhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-26 10:02:52 +0000
committerhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-26 10:02:52 +0000
commit0676a96af598e97e3b6016cd3675e2f424dc8407 (patch)
tree5ff6d221bdbbc1bba12a5b41f160fd68e2ef453a /chrome/browser/net
parent503683f23ea6fe3eb728f2d09f81f2603ffc7d6f (diff)
downloadchromium_src-0676a96af598e97e3b6016cd3675e2f424dc8407.zip
chromium_src-0676a96af598e97e3b6016cd3675e2f424dc8407.tar.gz
chromium_src-0676a96af598e97e3b6016cd3675e2f424dc8407.tar.bz2
Fixes Issue 7377: Regression: Omnibox trims URL ending with 0x85
To fix this issue, this change adds a new function TrimWhitespaceUTF8(), which trims space characters (including non-printable characters and broken UTF-8 characters) from either end of a UTF-8 string. Please feel free to give me your comments since I'm not sure this implimentation is correct. (Maybe this implementation trims too aggressively.) BUG=7377 Review URL: http://codereview.chromium.org/20219 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10456 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/url_fixer_upper.cc2
-rw-r--r--chrome/browser/net/url_fixer_upper_unittest.cc20
2 files changed, 21 insertions, 1 deletions
diff --git a/chrome/browser/net/url_fixer_upper.cc b/chrome/browser/net/url_fixer_upper.cc
index 121807b..08d60d2 100644
--- a/chrome/browser/net/url_fixer_upper.cc
+++ b/chrome/browser/net/url_fixer_upper.cc
@@ -360,7 +360,7 @@ string URLFixerUpper::SegmentURL(const string& text,
string URLFixerUpper::FixupURL(const string& text,
const string& desired_tld) {
string trimmed;
- TrimWhitespace(text, TRIM_ALL, &trimmed);
+ TrimWhitespaceUTF8(text, TRIM_ALL, &trimmed);
if (trimmed.empty())
return string(); // Nothing here.
diff --git a/chrome/browser/net/url_fixer_upper_unittest.cc b/chrome/browser/net/url_fixer_upper_unittest.cc
index 1e6dbc7..ef26b5e 100644
--- a/chrome/browser/net/url_fixer_upper_unittest.cc
+++ b/chrome/browser/net/url_fixer_upper_unittest.cc
@@ -177,6 +177,26 @@ struct fixup_case {
{"ftpblah.google.com", "", "http://ftpblah.google.com/"},
{"ftp", "", "http://ftp/"},
{"google.ftp.com", "", "http://google.ftp.com/"},
+ // URLs which end with an ISO-8859 next-line (0x85).
+ { "http://google.com/search?q=\xd0\x85", "",
+ "http://google.com/search?q=\xd0\x85"
+ },
+ { "http://google.com/search?q=\xec\x97\x85", "",
+ "http://google.com/search?q=\xec\x97\x85"
+ },
+ { "http://google.com/search?q=\xf0\x90\x80\x85", "",
+ "http://google.com/search?q=\xf0\x90\x80\x85"
+ },
+ // URLs which end with a non-break space (0xA0).
+ { "http://google.com/search?q=\xd0\xa0", "",
+ "http://google.com/search?q=\xd0\xa0"
+ },
+ { "http://google.com/search?q=\xec\x97\xa0", "",
+ "http://google.com/search?q=\xec\x97\xa0"
+ },
+ { "http://google.com/search?q=\xf0\x90\x80\xa0", "",
+ "http://google.com/search?q=\xf0\x90\x80\xa0"
+ },
};
TEST(URLFixerUpperTest, FixupURL) {