public static void main(String[] args) throws IOException {
File f = new File("E:"+File.separator+"1.doc");
InputStream in = new FileInputStream(f);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int i;
while ((i = in.read()) != -1) {
baos.write(i);
}
String str = baos.toString("ISO-8859-1");
str = java.net.URLEncoder.encode(str, "UTF-8");
System.out.println(str);
File fo = new File("E:"+File.separator+"2.doc");
OutputStream os = new FileOutputStream(fo);
str = java.net.URLDecoder.decode(str, "UTF-8");
os.write(str.getBytes("ISO-8859-1"));
os.close();
}
File f = new File("E:"+File.separator+"1.doc");
InputStream in = new FileInputStream(f);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int i;
while ((i = in.read()) != -1) {
baos.write(i);
}
String str = baos.toString("ISO-8859-1");
str = java.net.URLEncoder.encode(str, "UTF-8");
System.out.println(str);
File fo = new File("E:"+File.separator+"2.doc");
OutputStream os = new FileOutputStream(fo);
str = java.net.URLDecoder.decode(str, "UTF-8");
os.write(str.getBytes("ISO-8859-1"));
os.close();
}