Sending special characters in XMPP
So I'm trying to send a string like this
<message to="me"><body>\<foobar\></body></message>
The brackets seem to stop the transmission of the message, is t开发者_如何学Chere any way to escape the characters for example? How can I do this?
You need to properly escape the content for XML. In your case, the message must end up like this:
<message to="me"><body>\<foobar\></body></message>
For an entity escaper, have a look into StringEscapeUtils (I assume that you're doing this in Java).
As XMPP is an XML application, I'd try replacing < with <, & with & and, probably not necessarily, > with >.
加载中,请稍侯......
精彩评论