Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Unified Diff: components/search_engines/template_url_parser.cc

Issue 1238683003: Unpunycode search keywords and short names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Rebased to origin/master. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/search_engines/template_url_parser.cc
diff --git a/components/search_engines/template_url_parser.cc b/components/search_engines/template_url_parser.cc
index 51644b16d2b9e64578998a5fa5cc2528a3104caf..5455f82a77529fa71927d4becb3f73d6385c74e3 100644
--- a/components/search_engines/template_url_parser.cc
+++ b/components/search_engines/template_url_parser.cc
@@ -16,6 +16,7 @@
#include "components/search_engines/template_url.h"
#include "libxml/parser.h"
#include "libxml/xmlwriter.h"
+#include "net/base/net_util.h"
#include "ui/gfx/favicon_size.h"
#include "url/gurl.h"
#include "url/url_constants.h"
@@ -251,7 +252,11 @@ void TemplateURLParsingContext::EndElementImpl(void* ctx, const xmlChar* name) {
context->ProcessURLParams();
break;
case TemplateURLParsingContext::SHORT_NAME:
- context->data_.SetShortName(context->string_);
+ // If someone gives us ShortName in punycode, decode it.
+ context->data_.SetShortName(
+ base::IsStringASCII(context->string_)
Peter Kasting 2015/07/14 18:05:33 Why do an ASCII check here? Why not just uncondit
alshabalin 2015/07/15 14:18:01 IDNToUnicode requires ASCII because it calls ASCII
Peter Kasting 2015/07/15 21:19:12 At the least you need a comment in all these place
+ ? net::IDNToUnicode(base::UTF16ToASCII(context->string_), "")
+ : context->string_);
break;
case TemplateURLParsingContext::IMAGE: {
GURL image_url(base::UTF16ToUTF8(context->string_));

Powered by Google App Engine
This is Rietveld 408576698