From 128c8ef8d48c477f7c888a05b1d738d797cb4d1d Mon Sep 17 00:00:00 2001 From: luccioman Date: Wed, 21 Dec 2016 08:19:09 +0100 Subject: [PATCH] Fixed title rendering having non ASCII chars in QuickCrawlLink_p.html. --- htroot/QuickCrawlLink_p.java | 6 +++++- .../federate/solr/responsewriter/HTMLResponseWriter.java | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htroot/QuickCrawlLink_p.java b/htroot/QuickCrawlLink_p.java index 31c0cbc1c..aab340ea9 100644 --- a/htroot/QuickCrawlLink_p.java +++ b/htroot/QuickCrawlLink_p.java @@ -90,7 +90,11 @@ public class QuickCrawlLink_p { Segment indexSegment = sb.index; // get the browser title - final String title = post.get("title", null); + String title = post.get("title", null); + if(title != null) { + /* Decode eventual special(non ASCII) characters in title */ + title = UTF8.decodeURL(title); + } // get other parameters if set final String crawlingMustMatch = post.get("mustmatch", CrawlProfile.MATCH_ALL_STRING); diff --git a/source/net/yacy/cora/federate/solr/responsewriter/HTMLResponseWriter.java b/source/net/yacy/cora/federate/solr/responsewriter/HTMLResponseWriter.java index 6f8fa9a54..bd88eb644 100644 --- a/source/net/yacy/cora/federate/solr/responsewriter/HTMLResponseWriter.java +++ b/source/net/yacy/cora/federate/solr/responsewriter/HTMLResponseWriter.java @@ -22,6 +22,8 @@ package net.yacy.cora.federate.solr.responsewriter; import java.io.IOException; import java.io.Writer; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.Date; import java.util.LinkedHashMap; import java.util.List; @@ -195,7 +197,7 @@ public class HTMLResponseWriter implements QueryResponseWriter { // add a link to re-crawl this url (in case it is a remote metadata only entry) String sku = tdoc.get(CollectionSchema.sku.getSolrFieldName()); - final String jsc= "javascript:w = window.open('../QuickCrawlLink_p.html?indexText=on&indexMedia=on&crawlingQ=on&followFrames=on&obeyHtmlRobotsNoindex=on&obeyHtmlRobotsNofollow=off&xdstopw=on&title='+escape('"+title+"')+'&url='+escape('"+sku+"'),'_blank','height=250,width=600,resizable=yes,scrollbar=no,directory=no,menubar=no,location=no');w.focus();"; + final String jsc= "javascript:w = window.open('../QuickCrawlLink_p.html?indexText=on&indexMedia=on&crawlingQ=on&followFrames=on&obeyHtmlRobotsNoindex=on&obeyHtmlRobotsNofollow=off&xdstopw=on&title=" + URLEncoder.encode(title, StandardCharsets.UTF_8.name()) + "&url='+escape('"+sku+"'),'_blank','height=250,width=600,resizable=yes,scrollbar=no,directory=no,menubar=no,location=no');w.focus();"; writer.write("
re-crawl url
\n"); writer.write("

" + title + "

\n");