write to file and preserve accents and umlauts
I have an xml file, that I want to read and write different
output files for. I do not want use xml feature, just want
to separate the large input file in smaller output files.
Problem: the output text has things like "? " instead
of accented texts (i.e. passť appears like pass?).
I use eclipse, and the text in the console output, via
System.out.println(...) appears correct!
I tried to set the CharSet, but with no success.
Here is the relevant code part:
fi = new FileInputStream(dat);
is = new InputStreamReader(fi);
bufRd = new BufferedReader(is);
String sChSetOut = is.getEncoding(); // = "Cp1252"
fo = new FileOutputStream(datOut);
os = new OutputStreamWriter(fo, sChSetOut);
fWrt = new BufferedWriter(os);
line = bufRd.readLine();
// do the selection of the output file ...
fWrt.newLine(); // text in file lost accents and umlatus
// Echo written lines:
System.out.println(line); // text appears correct with accents
Thanks for help
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center