utf fix from theli

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2412 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
allo 19 years ago
parent 9add56dc09
commit cf1186597b

@ -123,7 +123,7 @@ public class listManager {
int count = 0;
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(listFile)));
br = new BufferedReader(new InputStreamReader(new FileInputStream(listFile),"UTF-8"));
while((line = br.readLine()) != null){
list.add(line);

@ -48,9 +48,11 @@ import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Enumeration;
@ -144,7 +146,7 @@ public class translator {
String line = "";
BufferedReader br = null;
try{
br = new BufferedReader(new InputStreamReader(new FileInputStream(sourceFile)));
br = new BufferedReader(new InputStreamReader(new FileInputStream(sourceFile),"UTF-8"));
while( (line = br.readLine()) != null){
content += line + de.anomic.server.serverCore.crlfString;
}
@ -158,7 +160,7 @@ public class translator {
content = translate(content, translationList);
BufferedWriter bw = null;
try{
bw = new BufferedWriter(new FileWriter(destFile));
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(destFile),"UTF-8"));
bw.write(content);
bw.close();
}catch(IOException e){

@ -301,7 +301,7 @@ public final class httpTemplate {
}
}else if( (bb & 0xFF) == lrbr ){ //alternatives
int others=0;
String text="";
serverByteBuffer text= new serverByteBuffer();
PushbackInputStream pis2;
transferUntil(pis, keyStream, aClose);
@ -369,10 +369,10 @@ public final class httpTemplate {
found=true;
}else if(others >0 && keyStream.toString().startsWith("/")){ //close nested
others--;
text += "#("+keyStream.toString()+")#";
text.append("#("+keyStream.toString()+")#");
}else{ //nested
others++;
text += "#("+keyStream.toString()+")#";
text.append("#("+keyStream.toString()+")#");
}
keyStream = new ByteArrayOutputStream(); //reset stream
continue;
@ -395,14 +395,14 @@ public final class httpTemplate {
found=true;
}
currentPattern++;
text="";
text.clear();
continue;
}else{
text += ":";
text.append(":");
}
}
if(!found){
text += (char)bb;
text.append((byte)bb);
if(pis.available()==0){
serverLog.logSevere("TEMPLATE", "No Close Key found for #("+key+")# (by Index)");
found=true;
@ -479,17 +479,19 @@ public final class httpTemplate {
Object value;
if (pattern.containsKey(key)) {
value = pattern.get(key);
try {
//try {
if (value instanceof byte[]) {
replacement = (byte[]) value;
} else if (value instanceof String) {
replacement = ((String) value).getBytes("UTF-8");
replacement = ((String) value).getBytes();
//replacement = ((String) value).getBytes("UTF-8");
} else {
replacement = value.toString().getBytes("UTF-8");
}
} catch (UnsupportedEncodingException e) {
replacement = dflt;
replacement = value.toString().getBytes();
//replacement = value.toString().getBytes("UTF-8");
}
// } catch (UnsupportedEncodingException e) {
// replacement = dflt;
// }
} else {
replacement = dflt;
}

Loading…
Cancel
Save