How to properly encode HTML within XML in PHP for SOAP
I'm attempting to communicate with Exchange 2007, and there are known bugs/problems with doing UpdateItem() so I'm manually communicating over cURL, building my own XML instead of letting the SOAP client do it. It all works fine, but I need to be able to properly encode HTML to fit within the elements of XML.
I know about html_encode() and htmlspecialchars() but I am unsure whether or not these are proper to use and whether or not in the future it may not encode correctly, and screw up the SOAP communication.
As开发者_JAVA技巧 a side note, if it matters, the communication will be in both English and Russian, so it needs to be Unicode safe.
Html_encode will use HTML entities. HTML entities are defined for HTML, but not for XML, so this won't work.
Escaping tags in XML is done by wrapping your content in CDATA tags. Special characters (üéâä) can be represented in UTF8.
精彩评论