I'm trying to convert UTF-8 text file into Windows-1250. I'm using Java 6 API.
I've used code below, but the result is definitely not a Cp1250.
import java.io.*;
public class testing {
public static void main (String[] args) throws IOException {
InputStream input = null;
OutputStreamWriter output = null;
File destinationFile = new File("C:\\test\\Cp1250.txt");
try {
input = new FileInputStream("C:\\test\\utf-8.txt");
output = new OutputStreamWriter(new FileOutputStream(destinationFile), "Windows-1250");
while (input.read() != -1) {
output.write(input.read());
}
} catch (Exception e) {
e.printStackTrace();
} finally {
input.close();
output.close();
}
}
}