diff --git a/test/org/jivesoftware/multiplexer/net/XMLLightweightParserTest.java b/test/org/jivesoftware/multiplexer/net/XMLLightweightParserTest.java index 7a14577..0204b11 100644 --- a/test/org/jivesoftware/multiplexer/net/XMLLightweightParserTest.java +++ b/test/org/jivesoftware/multiplexer/net/XMLLightweightParserTest.java @@ -150,6 +150,33 @@ assertEquals(stanza, doc.asXML()); } + public void testWeirdChars() throws Exception { + //String stanza = "� 2003 - 2007 by Monsters and Critics.com, WotR Ltd. All Rights Reserved. All photos are copyright their respective owners and are used under license or with permission. * Note M&C cannot be held responsible for the content on other Web Sites.5Yo2Kd"; + String stanza = "� 2003 - 2007 by Monsters and Critics.com, WotR Ltd. All Rights Reserved. All photos are copyright their respective owners and are used under license or with permission. * Note M\"&C cannot be held responsible for the content on other Web Sites.5Yo2Kd"; + + XmlPullParserFactory factory = XmlPullParserFactory.newInstance(MXParser.class.getName(), null); + factory.setNamespaceAware(true); + + XMPPPacketReader xmppReader = new XMPPPacketReader(); + xmppReader.setXPPFactory(factory); + Element doc = xmppReader.read(new StringReader(stanza)).getRootElement(); + assertNotNull(doc); + assertEquals(stanza, doc.asXML()); + } + + public void testEmptyElement() throws Exception { + String stanza = ""; + + XmlPullParserFactory factory = XmlPullParserFactory.newInstance(MXParser.class.getName(), null); + factory.setNamespaceAware(true); + + XMPPPacketReader xmppReader = new XMPPPacketReader(); + xmppReader.setXPPFactory(factory); + Element doc = xmppReader.read(new StringReader(stanza)).getRootElement(); + assertNotNull(doc); + assertEquals(stanza, doc.asXML()); + } + protected void setUp() throws Exception { super.setUp(); // Create parser