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

Unified Diff: chrome/browser/importer/firefox2_importer.cc

Issue 126036: Patch to solve the problem in import export bookmarks (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 6 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: chrome/browser/importer/firefox2_importer.cc
===================================================================
--- chrome/browser/importer/firefox2_importer.cc (revision 19491)
+++ chrome/browser/importer/firefox2_importer.cc (working copy)
@@ -447,8 +447,14 @@
// URL
if (GetAttribute(attribute_list, kHrefAttribute, &value)) {
- ReplaceSubstringsAfterOffset(&value, 0, "%22", "\"");
- *url = GURL(value);
+ std::wstring w_url;
+ CodepageToWide(value, charset.c_str(), OnStringUtilConversionError::SKIP,
+ &w_url);
+ HTMLUnescape(&w_url);
+
+ string16 url16 = WideToUTF16Hack(w_url);
+
+ *url = GURL(url16);
}
// Favicon
@@ -491,8 +497,17 @@
return false; // Can't find the attribute.
begin = attribute_list.find(kQuote, begin) + 1;
- size_t end = attribute_list.find(kQuote, begin);
- if (end == std::string::npos)
+
+ size_t end = begin + 1;
+ while (end < attribute_list.size()) {
+ if (attribute_list[end] == '"' &&
+ attribute_list[end - 1] != '\\') {
+ break;
+ }
+ end++;
+ }
+
+ if (end == attribute_list.size())
return false; // The value is not quoted.
*value = attribute_list.substr(begin, end - begin);
« no previous file with comments | « chrome/browser/bookmarks/bookmark_html_writer_unittest.cc ('k') | chrome/browser/importer/firefox_importer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698