UTF-8 rendering problem in JTree with XML
Posted on 2010-09-03
I have a problem that I can't figure out. I want to show a list of folder in a JTree. I download the list as an XML file from a server and have 2 issues when showing them in the tree.
1. Non latin char are not displayed correctly
2. Rendering in the node stops after special char (haven't tested them all but "&" char is a problem.
Here is an XML sample:
<?xml version="1.0" encoding="UTF-8"?>
<path>/01_Lancôme</path> //ô is displayed like oÌ,
<path>/V&R</path> //&R is not displayed at all
If I read it in a web browser, everything looks fine. I use the DefaultTreeCellRenderer and DefaultMutableTreeNode. Also when I print to System.out, it shows up correctly.