diff options
-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; |