String encoding

I’m creating a xml string with encoding UTF-8. I’ve encoded all the item text and id with URLEncoder.encode(value, “UTF-8”).
I display the tree in a jsp page as follow. treeXML is a jsp bean returning the xml string:

<script> var tree = new dhtmlXTreeObject("menuTree", "100%", "100%", 0); tree.setSkin("dhx_skyblue"); tree.setImagePath("../dhtmlxTree/codebase/imgs/csh_dhx_skyblue/"); tree.setOnClickHandler(onItemClicked); tree.loadXMLString('<%=treeXML.getTreeXML()%>');; }; </script>
The tree displays fine but I need to decode the item label. How can I do that as they show up encoded?
Thanks in advance for your help.


Why do you apply to tree xml URLEncoder.encode(value, “UTF-8”) ?

It seems that URLEncoder can be applied to urls only.

For instance if I have an item with text containing “&” characters, the tree cannot load since this is not a valid xml character for xml. It has to be encoded. My problem is to render back the item label for display.
Thank you


& needs being encoded as & and text with & will correctly rendered.

Thanks for worked fine!