import org.jdom2.Document;
import org.jdom2.input.SAXBuilder;
import java.io.FileReader;
public class Test1 {
@org.junit.Test
public void main() throws Exception {
SAXBuilder sax = new SAXBuilder();
Document doc = sax.build(new FileReader("resources/file.xml"));
System.out.println(doc.getRootElement().getText());
}
}
file.xml contains this: <root>©</root>
encoding is UTF-8.
Used libs jdom2-2.06, hamcrest-core-1.3, junit-4.11.
When I run this in IntelliJ output is such: ©
.
When I run this in NetBeans output is such: ©
.
If I put the code to public static void main and run it - everything is ok.
If I change FileReader to FileInputStream - everything is ok.
If I change FileReader to StringReader("<root>©</root>")
- everything is ok.
What can it be?