* strings for navigation links have to be urlencoded


git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7037 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
f1ori 14 years ago
parent eb97bed1df
commit 92df768c39

@ -26,6 +26,8 @@
package de.anomic.search; package de.anomic.search;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -357,6 +359,15 @@ public final class QueryParams {
return ret; return ret;
} }
public String queryStringForUrl() {
try {
return URLEncoder.encode(this.queryString, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return this.queryString;
}
}
public TreeSet<String>[] queryWords() { public TreeSet<String>[] queryWords() {
return cleanQuery(this.queryString); return cleanQuery(this.queryString);
} }
@ -445,7 +456,7 @@ public final class QueryParams {
sb.append(ampersand); sb.append(ampersand);
sb.append("query="); sb.append("query=");
sb.append(theQuery.queryString(true).replace(' ', '+')); sb.append(theQuery.queryStringForUrl());
sb.append((addToQuery == null) ? "" : "+" + addToQuery); sb.append((addToQuery == null) ? "" : "+" + addToQuery);
sb.append(ampersand); sb.append(ampersand);
@ -489,7 +500,7 @@ public final class QueryParams {
sb.append(ampersand); sb.append(ampersand);
sb.append("former="); sb.append("former=");
sb.append(theQuery.queryString(true)); sb.append(theQuery.queryStringForUrl());
return sb.toString(); return sb.toString();
} }

Loading…
Cancel
Save