bugfix for last commit

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4142 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
fuchsi 18 years ago
parent 33fb2f756d
commit c0f5fc51ef

@ -43,18 +43,19 @@ public class htmlTools {
*/ */
public static String encode(String text, final String[] map, int spos, int epos) { public static String encode(String text, final String[] map, int spos, int epos) {
StringBuffer sb = new StringBuffer(text.length()); StringBuffer sb = new StringBuffer(text.length());
search: while (spos < text.length()) { int textpos = 0;
search: while (textpos < text.length()) {
// find a (forward) mapping // find a (forward) mapping
loop: for (int i = spos; i < epos; i += 2) { loop: for (int i = spos; i < epos; i += 2) {
if (text.charAt(spos) != map[i].charAt(0)) continue loop; if (text.charAt(textpos) != map[i].charAt(0)) continue loop;
// found match // found match
sb.append(map[i + 1]); sb.append(map[i + 1]);
spos++; textpos++;
continue search; continue search;
} }
// not found match // not found match
sb.append(text.charAt(spos)); sb.append(text.charAt(spos));
spos++; textpos++;
} }
return sb.toString(); return sb.toString();

Loading…
Cancel
Save