I used what Eugene did there, and changed it a bit.
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); FileInputStream in = new FileInputStream(new File("XML.xml")); Document doc = dBuilder.parse(in, "UTF-8");
although it will be read as UTF-8 , if you type in the eclipse console, it will not show any "UTF-8" characters unless the java file is saved as "UTF-8" or at least that happened to me
source share