I want to generate
<td> </td>
using xom
.
None of these work:
private static void test(String s) {
Element e = new Element("td");
e.appendChild(s);
System.out.println("XML(\"" + s + "\"): " + e.toXML());
}
private static void test() throws UnsupportedEncodingException {
final String nbsp = "\u00A0";
final String nbsp2 = "\uC2A0";
final String nbsp3 = "&nbsp;";
test(nbsp);
test(nbsp2);
test(nbsp3);
test(" ");
final byte[] b = nbsp.getBytes("UTF-8");
test(new String(b, "UTF-8"));
}
I get
XML(" "): <td> </td>
XML("슠"): <td>슠</td>
XML("&nbsp;"): <td>&#038;nbsp;</td>
XML(" "): <td>&nbsp;</td>
XML(" "): <td> </td>
any ideas?
Character encoding is set to "UTF-8" in my IDE.