I want to write to a csv file in UTF-8 in java
I am using BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("temp.csv"),Charset.forName("UTF-8").newEncoder())); after searching the internet
I am still getting illegal characters.
I want to write "Kürzlich" to my file and later on read and write again from the same file. When I do so I get "Kürzlich"
How I am getting "Kürzlich": I am parsing a xml file using DOM.
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
InputStream openstream = url.openStream();
Document doc = dBuilder.parse(openstream);
doc.getDocumentElement().normalize();
and then I extract my string.
I do not care how it is shown on the screen. I want to compare the stuff I write in the file with another file which is converted perfectly.
Is it happening because of DOM structure? Is there a way around?