diff --git a/htroot/Blacklist_p.java b/htroot/Blacklist_p.java
index 252249b06..540a2d1d9 100644
--- a/htroot/Blacklist_p.java
+++ b/htroot/Blacklist_p.java
@@ -319,7 +319,7 @@ prop.putHTML("asd", "0");
while ((peername = hostList.firstKey()) != null) {
final String Hash = hostList.get(peername);
prop.putHTML(DISABLED + "otherHosts_" + peerCount + "_hash", Hash);
- prop.putHTML(DISABLED + "otherHosts_" + peerCount + "_name", peername, true);
+ prop.putXML(DISABLED + "otherHosts_" + peerCount + "_name", peername);
hostList.remove(peername);
peerCount++;
}
@@ -332,14 +332,14 @@ prop.putHTML("asd", "0");
int blacklistCount = 0;
if (dirlist != null) {
for (int i = 0; i <= dirlist.length - 1; i++) {
- prop.putHTML(DISABLED + BLACKLIST + blacklistCount + "_name", dirlist[i], true);
+ prop.putXML(DISABLED + BLACKLIST + blacklistCount + "_name", dirlist[i]);
prop.put(DISABLED + BLACKLIST + blacklistCount + "_selected", "0");
if (dirlist[i].equals(blacklistToUse)) { //current List
prop.put(DISABLED + BLACKLIST + blacklistCount + "_selected", "1");
for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {
- prop.putHTML(DISABLED + "currentActiveFor_" + blTypes + "_blTypeName",supportedBlacklistTypes[blTypes], true);
+ prop.putXML(DISABLED + "currentActiveFor_" + blTypes + "_blTypeName",supportedBlacklistTypes[blTypes]);
prop.put(DISABLED + "currentActiveFor_" + blTypes + "_checked",
listManager.listSetContains(supportedBlacklistTypes[blTypes] + ".BlackLists",dirlist[i]) ? "0" : "1");
}
@@ -366,7 +366,7 @@ prop.putHTML("asd", "0");
}
prop.put(DISABLED + "blackLists", blacklistCount);
- prop.putHTML(DISABLED + "currentBlacklist", (blacklistToUse==null) ? "" : blacklistToUse, true);
+ prop.putXML(DISABLED + "currentBlacklist", (blacklistToUse==null) ? "" : blacklistToUse);
prop.put("disabled", (blacklistToUse == null) ? "1" : "0");
return prop;
}
diff --git a/htroot/Blog.java b/htroot/Blog.java
index 21fe0acaf..867a5e55d 100644
--- a/htroot/Blog.java
+++ b/htroot/Blog.java
@@ -180,9 +180,9 @@ public class Blog {
try {
prop.put("mode", "1"); //edit
prop.put("mode_commentMode", page.getCommentMode());
- prop.putHTML("mode_author", new String(page.getAuthor(),"UTF-8"), xml);
+ prop.putHTML("mode_author", new String(page.getAuthor(),"UTF-8"));
prop.put("mode_pageid", page.getKey());
- prop.putHTML("mode_subject", new String(page.getSubject(), "UTF-8"), xml);
+ prop.putHTML("mode_subject", new String(page.getSubject(), "UTF-8"));
prop.put("mode_page-code", new String(page.getPage(), "UTF-8"));
} catch (final UnsupportedEncodingException e) {}
}
@@ -195,16 +195,16 @@ public class Blog {
if(hasRights) {
prop.put("mode", "2");//preview
prop.put("mode_commentMode", post.getInt("commentMode", 1));
- prop.putHTML("mode_pageid", pagename, xml);
+ prop.putHTML("mode_pageid", pagename);
try {
- prop.putHTML("mode_author", new String(author, "UTF-8"), xml);
+ prop.putHTML("mode_author", new String(author, "UTF-8"));
} catch (final UnsupportedEncodingException e) {
- prop.putHTML("mode_author", new String(author), xml);
+ prop.putHTML("mode_author", new String(author));
}
- prop.putHTML("mode_subject", post.get("subject",""), xml);
+ prop.putHTML("mode_subject", post.get("subject",""));
prop.put("mode_date", dateString(new Date()));
prop.putWiki("mode_page", post.get("content", ""));
- prop.putHTML("mode_page-code", post.get("content", ""), xml);
+ prop.putHTML("mode_page-code", post.get("content", ""));
}
else {
prop.put("mode", "3"); //access denied (no rights)
@@ -213,16 +213,16 @@ public class Blog {
else if(post.get("delete", "").equals("try")) {
if(hasRights) {
prop.put("mode", "4");
- prop.putHTML("mode_pageid", pagename, xml);
+ prop.putHTML("mode_pageid", pagename);
try {
- prop.putHTML("mode_author",new String(page.getAuthor(), "UTF-8"), xml);
+ prop.putHTML("mode_author",new String(page.getAuthor(), "UTF-8"));
} catch (final UnsupportedEncodingException e) {
- prop.putHTML("mode_author",new String(page.getAuthor()), xml);
+ prop.putHTML("mode_author",new String(page.getAuthor()));
}
try {
- prop.putHTML("mode_subject",new String(page.getSubject(),"UTF-8"), xml);
+ prop.putHTML("mode_subject",new String(page.getSubject(),"UTF-8"));
} catch (final UnsupportedEncodingException e) {
- prop.putHTML("mode_subject",new String(page.getSubject()), xml);
+ prop.putHTML("mode_subject",new String(page.getSubject()));
}
}
else prop.put("mode", "3"); //access denied (no rights)
@@ -246,7 +246,7 @@ public class Blog {
if(pagename.equals(DEFAULT_PAGE)) {
// XXX: where are "peername" and "address" used in the template?
// XXX: "clientname" is already set to the peername, no need for a new setting
- prop.putHTML("peername", sb.webIndex.seedDB.mySeed().getName(), xml);
+ prop.putHTML("peername", sb.webIndex.seedDB.mySeed().getName());
prop.put("address", address);
//index all entries
putBlogDefault(prop, sb, address, start, num, hasRights, xml);
@@ -321,16 +321,16 @@ public class Blog {
{
// subject
try {
- prop.putHTML("mode_entries_" + number + "_subject", new String(entry.getSubject(),"UTF-8"), xml);
+ prop.putHTML("mode_entries_" + number + "_subject", new String(entry.getSubject(),"UTF-8"));
} catch (final UnsupportedEncodingException e) {
- prop.putHTML("mode_entries_" + number + "_subject", new String(entry.getSubject()), xml);
+ prop.putHTML("mode_entries_" + number + "_subject", new String(entry.getSubject()));
}
// author
try {
- prop.putHTML("mode_entries_" + number + "_author", new String(entry.getAuthor(),"UTF-8"), xml);
+ prop.putHTML("mode_entries_" + number + "_author", new String(entry.getAuthor(),"UTF-8"));
} catch (final UnsupportedEncodingException e) {
- prop.putHTML("mode_entries_" + number + "_author", new String(entry.getAuthor()), xml);
+ prop.putHTML("mode_entries_" + number + "_author", new String(entry.getAuthor()));
}
// comments
diff --git a/htroot/CrawlProfileEditor_p.java b/htroot/CrawlProfileEditor_p.java
index 6b321d91c..be6120a0a 100644
--- a/htroot/CrawlProfileEditor_p.java
+++ b/htroot/CrawlProfileEditor_p.java
@@ -212,7 +212,7 @@ public class CrawlProfileEditor_p {
prop.put("crawlProfiles_" + count + "_dark", dark ? "1" : "0");
prop.put("crawlProfiles_" + count + "_status", active ? "1" : "0");
prop.put("crawlProfiles_" + count + "_name", profile.name());
- prop.putHTML("crawlProfiles_" + count + "_startURL", profile.startURL(), true);
+ prop.putXML("crawlProfiles_" + count + "_startURL", profile.startURL());
prop.put("crawlProfiles_" + count + "_handle", profile.handle());
prop.put("crawlProfiles_" + count + "_depth", profile.generalDepth());
prop.put("crawlProfiles_" + count + "_filter", profile.generalFilter());
diff --git a/htroot/MessageSend_p.java b/htroot/MessageSend_p.java
index cdf498b91..863bb6e81 100644
--- a/htroot/MessageSend_p.java
+++ b/htroot/MessageSend_p.java
@@ -81,7 +81,7 @@ public class MessageSend_p {
peerName = targetPeer.get(yacySeed.NAME,"nameless");
}
- prop.putHTML("mode_permission_peerName", peerName, true);
+ prop.putXML("mode_permission_peerName", peerName);
final String response = (result == null) ? null : (String) result.get("response");
if (response == null || result == null) {
// we don't have permission or other peer does not exist
@@ -98,11 +98,11 @@ public class MessageSend_p {
final int messagesize = Integer.parseInt(result.get("messagesize"));
final int attachmentsize = Integer.parseInt(result.get("attachmentsize"));
- prop.putHTML("mode_permission_response", response, true);
+ prop.putXML("mode_permission_response", response);
prop.put("mode_permission_messagesize", messagesize);
prop.put("mode_permission_attachmentsize", attachmentsize);
- prop.putHTML("mode_permission_subject", subject, true);
- prop.putHTML("mode_permission_message", message, true);
+ prop.putXML("mode_permission_subject", subject);
+ prop.putXML("mode_permission_message", message);
prop.putHTML("mode_permission_hash", hash);
if (post.containsKey("preview")) {
prop.putWiki("mode_permission_previewmessage", message);
@@ -140,7 +140,7 @@ public class MessageSend_p {
prop.put("mode_status", "1");
// "unresolved pattern", the remote peer is alive but had an exception
- prop.putHTML("mode_status_message", message, true);
+ prop.putXML("mode_status_message", message);
}
}
return prop;
diff --git a/htroot/Messages_p.java b/htroot/Messages_p.java
index 0fe80b5f7..e4462e0b2 100644
--- a/htroot/Messages_p.java
+++ b/htroot/Messages_p.java
@@ -58,7 +58,7 @@ public class Messages_p {
final String peerAddress = sb.webIndex.seedDB.mySeed().getPublicAddress();
final String peerName = sb.webIndex.seedDB.mySeed().getName();
prop.put("peerAddress", peerAddress);
- prop.putHTML("peerName", peerName, true);
+ prop.putXML("peerName", peerName);
// List known hosts for message sending (from Blacklist_p.java)
if (sb.webIndex.seedDB != null && sb.webIndex.seedDB.sizeConnected() > 0) {
@@ -76,7 +76,7 @@ public class Messages_p {
while ((peername = hostList.firstKey()) != null) {
final String Hash = hostList.get(peername);
prop.put(PEERSKNOWN + "peers_" + peerCount + "_hash", Hash);
- prop.putHTML(PEERSKNOWN + "peers_" + peerCount + "_name", peername, true);
+ prop.putXML(PEERSKNOWN + "peers_" + peerCount + "_name", peername);
hostList.remove(peername);
peerCount++;
}
@@ -119,11 +119,11 @@ public class Messages_p {
message = sb.messageDB.read(key);
prop.put("mode_messages_"+count+"_dark", ((dark) ? "1" : "0") );
prop.put("mode_messages_"+count+"_date", dateString(message.date()));
- prop.putHTML("mode_messages_"+count+"_from", message.author(), true);
- prop.putHTML("mode_messages_"+count+"_to", message.recipient(), true);
- prop.putHTML("mode_messages_"+count+"_subject", message.subject(), true);
- prop.putHTML("mode_messages_"+count+"_category", message.category(), true);
- prop.putHTML("mode_messages_"+count+"_key", key, true);
+ prop.putXML("mode_messages_"+count+"_from", message.author());
+ prop.putXML("mode_messages_"+count+"_to", message.recipient());
+ prop.putXML("mode_messages_"+count+"_subject", message.subject());
+ prop.putXML("mode_messages_"+count+"_category", message.category());
+ prop.putXML("mode_messages_"+count+"_key", key);
prop.put("mode_messages_"+count+"_hash", message.authorHash());
if ((header.get(httpRequestHeader.CONNECTION_PROP_PATH)).endsWith(".rss")) {
@@ -135,7 +135,7 @@ public class Messages_p {
// also write out the message body (needed for the RSS feed)
try {
- prop.putHTML("mode_messages_"+count+"_body",new String(message.message(), "UTF-8"), true);
+ prop.putXML("mode_messages_"+count+"_body",new String(message.message(), "UTF-8"));
} catch (final UnsupportedEncodingException e) {
// can not happen, because UTF-8 must be supported by every JVM
}
@@ -157,10 +157,10 @@ public class Messages_p {
message = sb.messageDB.read(key);
if (message == null) throw new NullPointerException("Message with ID " + key + " does not exist");
- prop.putHTML("mode_from", message.author(), true);
- prop.putHTML("mode_to", message.recipient(), true);
+ prop.putXML("mode_from", message.author());
+ prop.putXML("mode_to", message.recipient());
prop.put("mode_date", dateString(message.date()));
- prop.putHTML("mode_subject", message.subject(), true);
+ prop.putXML("mode_subject", message.subject());
String theMessage = null;
try {
theMessage = new String(message.message(), "UTF-8");
@@ -169,7 +169,7 @@ public class Messages_p {
}
prop.putWiki("mode_message", theMessage);
prop.put("mode_hash", message.authorHash());
- prop.putHTML("mode_key", key, true);
+ prop.putXML("mode_key", key);
}
// return rewrite properties
diff --git a/htroot/PerformanceQueues_p.java b/htroot/PerformanceQueues_p.java
index 08bcd607e..76c2aa089 100644
--- a/htroot/PerformanceQueues_p.java
+++ b/htroot/PerformanceQueues_p.java
@@ -111,14 +111,14 @@ public class PerformanceQueues_p {
// set values to templates
prop.put("table_" + c + "_threadname", threadName);
- prop.putHTML("table_" + c + "_hasurl_shortdescr", thread.getShortDescription(), xml);
+ prop.putHTML("table_" + c + "_hasurl_shortdescr", thread.getShortDescription());
if(thread.getMonitorURL() == null) {
prop.put("table_"+c+"_hasurl", "0");
}else{
prop.put("table_"+c+"_hasurl", "1");
prop.put("table_" + c + "_hasurl_url", thread.getMonitorURL());
}
- prop.putHTML("table_" + c + "_longdescr", thread.getLongDescription(), xml);
+ prop.putHTML("table_" + c + "_longdescr", thread.getLongDescription());
queuesize = thread.getJobCount();
prop.put("table_" + c + "_queuesize", (queuesize == Integer.MAX_VALUE) ? "unlimited" : yFormatter.number(queuesize, !xml));
diff --git a/htroot/Settings_p.java b/htroot/Settings_p.java
index 753c7395f..93f10b21d 100644
--- a/htroot/Settings_p.java
+++ b/htroot/Settings_p.java
@@ -162,7 +162,7 @@ public final class Settings_p {
}
// clientIP
- prop.putHTML("clientIP", (String) header.get(httpRequestHeader.CONNECTION_PROP_CLIENTIP, "
"));
+ sb.append("\">").append(htmlFilterCharacterCoding.unicode2html(ps[j].getString(), true).replaceAll("\n", "
"));
sb.append("");
}
sb.append("
false
ampersands are not encoded
- * @param forXML if true
then only &, ", < and > will
- * be transcoded.
- * @return the string with all characters replaced by the corresponding character from array
- */
- public static String encodeUnicode2html(final String text, final boolean includingAmpersand, final boolean forXML) {
- if (text == null)
- return null;
-
- final int spos = (includingAmpersand ? 0 : 2);
- // if (forXML), then only encode ampersand, quotation mark, less than and
- // greather than which are the first 4 pairs in default mapping table
- final int epos = (forXML ? 8 : mapping.length);
+public class htmlFilterCharacterCoding {
- return encode(text, mapping, spos, epos);
- }
+ private static final char amp_unicode = "\u0026".charAt(0);
+ private static final String amp_html = "&";
- /**
- * Like {@link #encodeUnicode2html(String, boolean, boolean)} with forXML = false
- */
- public static String encodeUnicode2html(final String text, final boolean includingAmpersand) {
- return encodeUnicode2html(text, includingAmpersand, false);
- }
-
-
- /**
- * Replaces special entities ampersand, quotation marks, and less than/graiter than
- * by the escaping entities allowed in XML documents.
- *
- * Like {@link #encodeUnicode2html(String, boolean, boolean)} with
- * includingAmpersand = true
and foxXML = true
.
- *
- * @param text the original String
- * @return the encoded String
- */
- public static String encodeUnicode2xml(final String text) {
- return encodeUnicode2html(text, true, true);
- }
-
- /**
- * Generic method that replaces occurences of special character entities defined in map
- * array with their corresponding mapping.
- * @param text The String too process.
- * @param map An array defining the entity mapping.
- * @param spos It is possible to use a subset of the map only. This parameter defines the
- * starting point in the map array.
- * @param epos The ending point, see above.
- * @return A copy of the original String with all entities defined in map replaced.
- */
- public static String encode(final String text, final String[] map, final int spos, final int epos) {
- final StringBuffer sb = new StringBuffer(text.length());
- int textpos = 0;
- search: while (textpos < text.length()) {
- // find a (forward) mapping
- loop: for (int i = spos; i < epos; i += 2) {
- if (text.charAt(textpos) != map[i].charAt(0)) continue loop;
- // found match
- sb.append(map[i + 1]);
- textpos++;
- continue search;
- }
- // not found match
- sb.append(text.charAt(textpos));
- textpos++;
- }
-
- return sb.toString();
- }
+ private static final String[] mapping4xml = {
+ "\"",""", //quotation mark
+ "\u003C","<", //less than
+ "\u003E",">", //greater than
+ };
- public static String decodeHtml2Unicode(final String text) {
- if (text == null) return null;
- int pos = 0;
- final StringBuffer sb = new StringBuffer(text.length());
- search: while (pos < text.length()) {
- // find a reverse mapping. TODO: replace matching with hashtable(s)
- loop: for (int i = 0; i < mapping.length; i += 2) {
- if (pos + mapping[i + 1].length() > text.length()) continue loop;
- for (int j = mapping[i + 1].length() - 1; j >= 0; j--) {
- if (text.charAt(pos + j) != mapping[i + 1].charAt(j)) continue loop;
- }
- // found match
- sb.append(mapping[i]);
- pos = pos + mapping[i + 1].length();
- continue search;
- }
- // not found match
- sb.append(text.charAt(pos));
- pos++;
- }
- return new String(sb);
- }
-
- //This array contains codes (see http://mindprod.com/jgloss/unicode.html for details)
- //that will be replaced. To add new codes or patterns, just put them at the end
- //of the list. Codes or patterns in this list can not be escaped with [= or - private static final String[] mapping = { - // Ampersands _have_ to be replaced first. If they were replaced later, - // other replaced characters containing ampersands would get messed up. - "\u0026","&", //ampersand - "\"",""", //quotation mark - "\u003C","<", //less than - "\u003E",">", //greater than + private static final String[] mapping4html = { "\\", "\", // Backslash "\u005E","^", // Caret @@ -267,15 +170,109 @@ public class htmlTools { "\u00FF","ÿ" }; + private final static HashMaphtml2unicode4xml = new HashMap (); + private final static HashMap html2unicode4html = new HashMap (); + private final static HashMap unicode2html4xml = new HashMap (); + private final static HashMap unicode2html4html = new HashMap (); + static { + Character c; + for (int i = 0; i < mapping4html.length; i += 2) { + c = new Character(mapping4html[i].charAt(0)); + html2unicode4html.put(mapping4html[i + 1], c); + unicode2html4html.put(c, mapping4html[i + 1]); + } + for (int i = 0; i < mapping4xml.length; i += 2) { + c = new Character(mapping4xml[i].charAt(0)); + html2unicode4xml.put(mapping4xml[i + 1], c); + unicode2html4xml.put(c, mapping4xml[i + 1]); + } + } + + public static String unicode2xml(final String text, boolean amp) { + return unicode2html(text, amp, false); + } + + public static String unicode2html(final String text, boolean amp) { + return unicode2html(text, amp, true); + } + + private static String unicode2html(final String text, boolean amp, boolean html) { + if (text == null) return null; + final StringBuffer sb = new StringBuffer(text.length() * 12 / 10); + int textpos = 0; + String r; + char c; + while (textpos < text.length()) { + // find a (forward) mapping + c = text.charAt(textpos); + if (amp && c == amp_unicode) { + sb.append(amp_html); + textpos++; + continue; + } + if ((r = unicode2html4xml.get(c)) != null) { + sb.append(r); + textpos++; + continue; + } + if (html && (r = unicode2html4html.get(c)) != null) { + sb.append(r); + textpos++; + continue; + } + sb.append(c); + textpos++; + } + return sb.toString(); + } + + public static String html2unicode(final String text) { + if (text == null) return null; + int p = 0, p1, q; + final StringBuffer sb = new StringBuffer(text.length()); + String s; + Character r; + while (p < text.length()) { + p1 = text.indexOf('&', p); + if (p1 < 0) p1 = text.length(); + sb.append(text.subSequence(p, p1)); + p = p1; + if (p >= text.length()) break; + q = text.indexOf(';', p); + if (q < 0) { + p++; + continue; + } + s = text.substring(p, q + 1); + if (s.equals(amp_html)) { + sb.append(amp_unicode); + p = q + 1; + continue; + } + if ((r = html2unicode4xml.get(s)) != null) { + sb.append(r.charValue()); + p = q + 1; + continue; + } + if ((r = html2unicode4html.get(s)) != null) { + sb.append(r); + p = q + 1; + continue; + } + // the entity is unknown, skip it + } + return new String(sb); + } + public static void main(final String[] args) { final String text = "Test-Text mit & um zyklische ü & Ersetzungen auszuschliessen"; - final String txet = encodeUnicode2html(text, true); + final String txet = unicode2html(text, true); System.out.println(txet); - System.out.println(decodeHtml2Unicode(txet)); - if (decodeHtml2Unicode(txet).equals(text)) System.out.println("correct"); + System.out.println(html2unicode(txet)); + if (html2unicode(txet).equals(text)) System.out.println("correct"); final String text2 = "encodeUnicode2xml: & \" < >"; System.out.println(text2); - System.out.println(encodeUnicode2xml(text2)); + System.out.println(unicode2xml(text2, true)); } } diff --git a/source/de/anomic/htmlFilter/htmlFilterContentScraper.java b/source/de/anomic/htmlFilter/htmlFilterContentScraper.java index d5f7bd89e..e47e7124b 100644 --- a/source/de/anomic/htmlFilter/htmlFilterContentScraper.java +++ b/source/de/anomic/htmlFilter/htmlFilterContentScraper.java @@ -44,7 +44,6 @@ import java.util.Properties; import javax.swing.event.EventListenerList; import de.anomic.crawler.HTTPLoader; -import de.anomic.data.htmlTools; import de.anomic.http.HttpClient; import de.anomic.http.httpRequestHeader; import de.anomic.server.serverCharBuffer; @@ -166,11 +165,11 @@ public class htmlFilterContentScraper extends htmlFilterAbstractScraper implemen if (tagname.equalsIgnoreCase("meta")) { String name = tagopts.getProperty("name", ""); if (name.length() > 0) { - metas.put(name.toLowerCase(), htmlTools.decodeHtml2Unicode(tagopts.getProperty("content",""))); + metas.put(name.toLowerCase(), htmlFilterCharacterCoding.html2unicode(tagopts.getProperty("content",""))); } else { name = tagopts.getProperty("http-equiv", ""); if (name.length() > 0) { - metas.put(name.toLowerCase(), htmlTools.decodeHtml2Unicode(tagopts.getProperty("content",""))); + metas.put(name.toLowerCase(), htmlFilterCharacterCoding.html2unicode(tagopts.getProperty("content",""))); } } } diff --git a/source/de/anomic/http/httpd.java b/source/de/anomic/http/httpd.java index a94bbc9ee..1c94b236f 100644 --- a/source/de/anomic/http/httpd.java +++ b/source/de/anomic/http/httpd.java @@ -59,8 +59,8 @@ import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.httpclient.ChunkedInputStream; import org.apache.commons.httpclient.ContentLengthInputStream; -import de.anomic.data.htmlTools; import de.anomic.data.userDB; +import de.anomic.htmlFilter.htmlFilterCharacterCoding; import de.anomic.kelondro.kelondroBase64Order; import de.anomic.plasma.plasmaSwitchboard; import de.anomic.server.serverByteBuffer; @@ -850,7 +850,7 @@ public final class httpd implements serverHandler, Cloneable { // 06.01.2007: decode HTML entities by [FB] public static String decodeHtmlEntities(String s) { // replace all entities defined in wikiCode.characters and htmlentities - s = htmlTools.decodeHtml2Unicode(s); + s = htmlFilterCharacterCoding.html2unicode(s); // replace all other final CharArrayWriter b = new CharArrayWriter(s.length()); diff --git a/source/de/anomic/index/indexRepositoryReference.java b/source/de/anomic/index/indexRepositoryReference.java index 23332d5e6..883ab1abd 100644 --- a/source/de/anomic/index/indexRepositoryReference.java +++ b/source/de/anomic/index/indexRepositoryReference.java @@ -39,7 +39,7 @@ import java.util.Iterator; import java.util.Map; import java.util.TreeSet; -import de.anomic.data.htmlTools; +import de.anomic.htmlFilter.htmlFilterCharacterCoding; import de.anomic.http.JakartaCommonsHttpClient; import de.anomic.http.JakartaCommonsHttpResponse; import de.anomic.http.httpRemoteProxyConfig; @@ -452,14 +452,14 @@ public final class indexRepositoryReference { pw.println(url); } if (format == 1) { - pw.println("" + htmlTools.encodeUnicode2html(comp.dc_title(), true, true) + "
"); + pw.println("" + htmlFilterCharacterCoding.unicode2xml(comp.dc_title(), true) + "
"); } if (format == 2) { pw.println("- "); - pw.println("
"); diff --git a/source/de/anomic/plasma/plasmaSearchQuery.java b/source/de/anomic/plasma/plasmaSearchQuery.java index d80fcbedd..a5e529f3c 100644 --- a/source/de/anomic/plasma/plasmaSearchQuery.java +++ b/source/de/anomic/plasma/plasmaSearchQuery.java @@ -26,8 +26,8 @@ import java.util.Iterator; import java.util.Set; import java.util.TreeSet; -import de.anomic.data.htmlTools; import de.anomic.htmlFilter.htmlFilterAbstractScraper; +import de.anomic.htmlFilter.htmlFilterCharacterCoding; import de.anomic.index.indexWord; import de.anomic.kelondro.kelondroBase64Order; import de.anomic.kelondro.kelondroBitfield; @@ -266,7 +266,7 @@ public final class plasmaSearchQuery { public String queryString(final boolean encodeHTML) { if(encodeHTML){ - return htmlTools.encodeUnicode2html(this.queryString, true); + return htmlFilterCharacterCoding.unicode2html(this.queryString, true); } return this.queryString; } diff --git a/source/de/anomic/server/serverObjects.java b/source/de/anomic/server/serverObjects.java index 7c1e1160c..e4083da1b 100644 --- a/source/de/anomic/server/serverObjects.java +++ b/source/de/anomic/server/serverObjects.java @@ -52,7 +52,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import de.anomic.data.htmlTools; +import de.anomic.htmlFilter.htmlFilterCharacterCoding; import de.anomic.plasma.plasmaSwitchboard; import de.anomic.tools.yFormatter; @@ -146,10 +146,10 @@ public class serverObjects extends HashMap" + htmlTools.encodeUnicode2html(comp.dc_title(), true, true) + " "); + pw.println("" + htmlFilterCharacterCoding.unicode2xml(comp.dc_title(), true) + " "); pw.println("" + yacyURL.escape(url) + ""); - if (comp.dc_creator().length() > 0) pw.println("" + htmlTools.encodeUnicode2html(comp.dc_creator(), true, true) + " "); - if (comp.dc_subject().length() > 0) pw.println("" + htmlTools.encodeUnicode2html(comp.dc_subject(), true, true) + " "); + if (comp.dc_creator().length() > 0) pw.println("" + htmlFilterCharacterCoding.unicode2xml(comp.dc_creator(), true) + " "); + if (comp.dc_subject().length() > 0) pw.println("" + htmlFilterCharacterCoding.unicode2xml(comp.dc_subject(), true) + " "); pw.println("" + entry.moddate().toString() + " "); pw.println("" + entry.hash() + " "); pw.println("implements Cloneable * @param key key name as String. * @param value a String that will be reencoded for HTML output. * @return the modified String that was added to the map. - * @see htmlTools#encodeUnicode2html(String, boolean) + * @see htmlFilterCharacterCoding#encodeUnicode2html(String, boolean) */ public String putHTML(final String key, final String value) { - return putHTML(key, value, false); + return put(key, htmlFilterCharacterCoding.unicode2html(value, true)); } /** @@ -158,8 +158,8 @@ public class serverObjects extends HashMap implements Cloneable * If forXML is true
, then only the characters & " < > will be * replaced in the returned String. */ - public String putHTML(final String key, final String value, final boolean forXML) { - return put(key, htmlTools.encodeUnicode2html(value, true, forXML)); + public String putXML(final String key, final String value) { + return put(key, htmlFilterCharacterCoding.unicode2xml(value, true)); } /**