*) next bugfix for UTF-8

- Sending UFT-8 messages to other peers did not work
   - httpd.java: minor corrections for UTF-8

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2570 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 18 years ago
parent bdc51591ae
commit 2a06ce5538

@ -1013,29 +1013,29 @@ public final class httpc {
Enumeration e = args.keys();
while (e.hasMoreElements()) {
// start with a boundary
out.write(boundary.getBytes());
out.write(boundary.getBytes("UTF-8"));
out.write(serverCore.crlf);
// write value
key = (String) e.nextElement();
value = args.get(key, "");
if ((files != null) && (files.containsKey(key))) {
// we are about to write a file
out.write(("Content-Disposition: form-data; name=" + '"' + key + '"' + "; filename=" + '"' + value + '"').getBytes());
out.write(("Content-Disposition: form-data; name=" + '"' + key + '"' + "; filename=" + '"' + value + '"').getBytes("UTF-8"));
out.write(serverCore.crlf);
out.write(serverCore.crlf);
out.write((byte[]) files.get(key));
out.write(serverCore.crlf);
} else {
// write a single value
out.write(("Content-Disposition: form-data; name=" + '"' + key + '"').getBytes());
out.write(("Content-Disposition: form-data; name=" + '"' + key + '"').getBytes("UTF-8"));
out.write(serverCore.crlf);
out.write(serverCore.crlf);
out.write(value.getBytes());
out.write(value.getBytes("UTF-8"));
out.write(serverCore.crlf);
}
}
// finish with a boundary
out.write(boundary.getBytes());
out.write(boundary.getBytes("UTF-8"));
out.write(serverCore.crlf);
}
// create body array

@ -1118,14 +1118,14 @@ public final class httpd implements serverHandler {
tp.put("printStackTrace",1);
serverByteBuffer errorMsg = new serverByteBuffer(100);
errorMsg.append("<i>Exception occurred:</i>&nbsp;<b>")
.append(stackTrace.toString())
.append("</b>\r\n\r\n")
.append("</i>TRACE:</i>\r\n");
errorMsg.append("<i>Exception occurred:</i>&nbsp;<b>".getBytes("UTF-8"))
.append(stackTrace.toString().getBytes("UTF-8"))
.append("</b>\r\n\r\n".getBytes("UTF-8"))
.append("</i>TRACE:</i>\r\n".getBytes("UTF-8"));
stackTrace.printStackTrace(new PrintStream(errorMsg));
errorMsg.append("\r\n");
errorMsg.append("\r\n".getBytes("UTF-8"));
tp.put("printStackTrace_stacktrace",errorMsg.toString().replaceAll("\n","<br>"));
tp.put("printStackTrace_stacktrace",(new String(errorMsg.getBytes(),"UTF-8")).replaceAll("\n","<br>"));
} else {
tp.put("printStackTrace",0);
}

Loading…
Cancel
Save