-
write to file and preserve accents and umlauts
Hello
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 ...
// Write:
fWrt.write(line);
fWrt.newLine(); // text in file lost accents and umlatus
// Echo written lines:
System.out.println(line); // text appears correct with accents
Thanks for help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks