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

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: Remove UTF-8 from source code, use std::string(). 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..9f8d4aaa4a8a5d5f445d18262c431164a79b5daf 100644
--- a/components/search_engines/template_url_parser.cc
+++ b/components/search_engines/template_url_parser.cc
@@ -6,6 +6,7 @@
#include <algorithm>
#include <map>
+#include <string>
#include <vector>
#include "base/logging.h"
@@ -16,6 +17,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 +253,12 @@ 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_)
Matt Giuca 2015/07/17 04:13:11 This should not be unpunycoded. The ShortName fiel
alshabalin 2015/07/20 14:06:38 Done.
+ ? net::IDNToUnicode(base::UTF16ToASCII(context->string_),
+ std::string())
+ : context->string_);
break;
case TemplateURLParsingContext::IMAGE: {
GURL image_url(base::UTF16ToUTF8(context->string_));

Powered by Google App Engine
This is Rietveld 408576698