Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

- added decode of UTF-16 escapes in url-arguments (%u0123), bugfix for http://www.yacy-forum.de/viewtopic.php?t=2762

karlchenofhell6118fb73ec23
diff --git a/source/de/anomic/http/httpd.java b/source/de/anomic/http/httpd.java
index 101e27adf..8305ed0ee 100644
--- a/source/de/anomic/http/httpd.java
+++ b/source/de/anomic/http/httpd.java
@@ -767,8 +767,15 @@ public final class httpd implements serverHandler {
baos.write(' ');
pos++;
} else if (s.charAt(pos) == '%') {
- baos.write(Integer.parseInt(s.substring(pos + 1, pos + 3), 16));
- pos += 3;
+ // start change by [FB]: added UTF-escapes
+ if (s.charAt(pos + 1) == 'u') { // UTF-16 escape
+ pos += 6;
+ baos.write(Integer.parseInt(s.substring(pos + 2, pos + 6), 16));
+ } else { // normal escape
+ pos += 3;
+ baos.write(Integer.parseInt(s.substring(pos + 1, pos + 3), 16));
+ }
+ // end change by [FB]
} else {
baos.write(s.charAt(pos++));
}