From bdc51591ae7daa3592039cf64683a8f565d24c2d Mon Sep 17 00:00:00 2001 From: theli Date: Wed, 13 Sep 2006 14:48:58 +0000 Subject: [PATCH] *) UTF-8 Bug solved (hopefully) See: http://www.yacy-forum.de/viewtopic.php?p=25522 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2569 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/http/httpTemplate.java | 24 ++++++++++----------- source/de/anomic/http/httpdFileHandler.java | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/source/de/anomic/http/httpTemplate.java b/source/de/anomic/http/httpTemplate.java index 00ff87713..3b68b69b4 100644 --- a/source/de/anomic/http/httpTemplate.java +++ b/source/de/anomic/http/httpTemplate.java @@ -492,19 +492,19 @@ public final class httpTemplate { 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; } diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.java index 28c612602..e42e7f609 100644 --- a/source/de/anomic/http/httpdFileHandler.java +++ b/source/de/anomic/http/httpdFileHandler.java @@ -726,7 +726,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http 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();