Details
-
Type: Bug
-
Status: Closed
-
Resolution: Won't Fix
-
Affects Version/s: None
-
Fix Version/s: 1.2
-
Component/s: None
-
Labels:None
Description
XSTREAM does not escape German Umlaute (ü) and special characters (ß) correctly leading to invalid XML.
Example:
<tree-map>
<no-comparator/>
<entry>
<string>footerText</string>
<string>Mit freundlichen Grüßen,
Johan</string>
</entry>
</tree-map>
Testcase:
public class XStreamTest extends junit.framework.TestCase
{
/**
*
- @see http://www.w3.org/TR/REC-html40/sgml/entities.html
*/
public void testUmlaute() { final com.thoughtworks.xstream.XStream xstream = new com.thoughtworks.xstream.XStream(); assertTrue(xstream.toXML("").equals("<string></string>")); assertTrue(xstream.toXML("ß").equals("<string>ß</string>")); assertTrue(xstream.toXML("ä").equals("<string>ä</string>")); assertTrue(xstream.toXML("ö").equals("<string>ö</string>")); assertTrue(xstream.toXML("ü").equals("<string>ü</string>")); assertTrue(xstream.toXML("Ä").equals("<string>Ä</string>")); assertTrue(xstream.toXML("Ö").equals("<string>Ö</string>")); assertTrue(xstream.toXML("Ü").equals("<string>Ü</string>")); }}
This is not a bug. The XML is written in the default locale of the driver, which is the system's default for the Xpp3Driver. There's no requirement, that XML must be written in UTF-8 only. See the mailing list archives of last week, where I answered this last week and gave more details.