posted 18 years ago
I want to encode the US-ASCII data into UTF-8.
For that what is the procedure.
I have to use
1.InputStreamReader and OutPutStreamReader
2.Charset/CharsetEncoder/CharsetDecoder
What is the difference between the two processes?
Process 1:
FileInputStream fis = new FileInputStream(inputFile);
InputStreamReader isr = new InputStreamReader(fis,"UTF-8");
FileOutputStream fos = new FileOutputStream(outputFile);
OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
Process 2:
Charset charset = Charset.forName(encode);
CharsetDecoder decoder = charset.newDecoder();
CharsetEncoder encoder = charset.newEncoder();