Skip to content

Commit

Permalink
*) UTF-8 Bug solved (hopefully)
Browse files Browse the repository at this point in the history
  • Loading branch information
theli committed Sep 13, 2006
1 parent 13d0cff commit bdc5159
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions source/de/anomic/http/httpTemplate.java
Expand Up @@ -492,19 +492,19 @@ public static byte[] replacePattern(String key, Hashtable pattern, byte dflt[])
Object value;
if (pattern.containsKey(key)) {
value = pattern.get(key);
//try {
if (value instanceof byte[]) {
replacement = (byte[]) value;
} else if (value instanceof String) {
replacement = ((String) value).getBytes();
//replacement = ((String) value).getBytes("UTF-8");
} else {
replacement = value.toString().getBytes();
//replacement = value.toString().getBytes("UTF-8");
try {
if (value instanceof byte[]) {
replacement = (byte[]) value;
} else if (value instanceof String) {
//replacement = ((String) value).getBytes();
replacement = ((String) value).getBytes("UTF-8");
} else {
//replacement = value.toString().getBytes();
replacement = value.toString().getBytes("UTF-8");
}
} catch (UnsupportedEncodingException e) {
replacement = dflt;
}
// } catch (UnsupportedEncodingException e) {
// replacement = dflt;
// }
} else {
replacement = dflt;
}
Expand Down
2 changes: 1 addition & 1 deletion source/de/anomic/http/httpdFileHandler.java
Expand Up @@ -726,7 +726,7 @@ public void doResponse(Properties conProp, httpHeader requestHeader, OutputStrea

o = new serverByteBuffer();
if (zipContent) zippedOut = new GZIPOutputStream(o);
httpTemplate.writeTemplate(fis, (zipContent) ? (OutputStream)zippedOut: (OutputStream)o, tp, "-UNRESOLVED_PATTERN-".getBytes());
httpTemplate.writeTemplate(fis, (zipContent) ? (OutputStream)zippedOut: (OutputStream)o, tp, "-UNRESOLVED_PATTERN-".getBytes("UTF-8"));
if (zipContent) {
zippedOut.finish();
zippedOut.flush();
Expand Down

0 comments on commit bdc5159

Please sign in to comment.