diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 19:37:44 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 19:37:44 +0000 |
commit | 7df4348513bd316224dbc1399990a2538c55a5bc (patch) | |
tree | eaed7a9d1f1667137d680bc9505f936b2cfeb555 /chrome/browser/search_engines | |
parent | 655acaa9b4d9e2fb912739902aebaee99e16b68f (diff) | |
download | chromium_src-7df4348513bd316224dbc1399990a2538c55a5bc.zip chromium_src-7df4348513bd316224dbc1399990a2538c55a5bc.tar.gz chromium_src-7df4348513bd316224dbc1399990a2538c55a5bc.tar.bz2 |
Fixes bug in creating search terms where we weren't unescaping
correctly.
BUG=17697
TEST=covered by unit tests
Review URL: http://codereview.chromium.org/159707
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22167 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/search_engines')
-rw-r--r-- | chrome/browser/search_engines/template_url.cc | 3 | ||||
-rw-r--r-- | chrome/browser/search_engines/template_url_unittest.cc | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/chrome/browser/search_engines/template_url.cc b/chrome/browser/search_engines/template_url.cc index 0c98d48..2084780 100644 --- a/chrome/browser/search_engines/template_url.cc +++ b/chrome/browser/search_engines/template_url.cc @@ -399,7 +399,8 @@ std::wstring TemplateURLRef::SearchTermToWide(const TemplateURL& host, std::wstring result; std::string unescaped = - UnescapeURLComponent(term, UnescapeRule::REPLACE_PLUS_WITH_SPACE); + UnescapeURLComponent(term, UnescapeRule::REPLACE_PLUS_WITH_SPACE | + UnescapeRule::URL_SPECIAL_CHARS); for (size_t i = 0; i < encodings.size(); ++i) { if (CodepageToWide(unescaped, encodings[i].c_str(), OnStringUtilConversionError::FAIL, &result)) diff --git a/chrome/browser/search_engines/template_url_unittest.cc b/chrome/browser/search_engines/template_url_unittest.cc index f6825d2..3d2ed7a 100644 --- a/chrome/browser/search_engines/template_url_unittest.cc +++ b/chrome/browser/search_engines/template_url_unittest.cc @@ -144,6 +144,10 @@ TEST_F(TemplateURLTest, URLRefTermToWide) { {"%e4%bd%a05%e5%a5%bd+to+you", L"\x4f60\x35\x597d to you"}, // Undecodable input should stay escaped. {"%91%01+abcd", L"%91%01 abcd"}, + // Make sure we convert %2B to +. + {"C%2B%2B", L"C++"}, + // C%2B is escaped as C%252B, make sure we unescape it properly. + {"C%252B", L"C%2B"}, }; TemplateURL t_url; |