[thelist] FW: XML PHP Special Characters

Mattias Thorslund mattias at inreach.com
Mon Mar 28 18:19:20 CST 2005


Try using a CDATA section in the XML document for the troublesome text:

<myelement><![CDATA[ xy&z all kinds of ch at racters here ]]></myelement>

hth,
/Mattias


Mark Joslyn wrote:

>List,
>
>I am parsing an XML document with PHP:
>
>// Create an XML parser 
>$xml_parser = xml_parser_create(); 
>
>// Set the functions to handle opening and closing tags 
>xml_set_element_handler($xml_parser, "startElement", "endElement"); 
>
>etc..
>
>I have a special character inside the XML document (trademark symbol ™) that
>is being parsed and what is returned is a question mark.
>
>The XML document is encoded as:
>
><?xml version="1.0" encoding="iso-8859-1"?>
>
>The special character I am using is coded as: 
>
>&#x2122; but I have used &#8482;
>
>The php page is encoded:
>
><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
>
>Is there a way I can have this special character go through the parsing
>process but still return a valid trademark symbol?
>
>Any help would be appreciated.
>
>Thanks,
>
>markJ
>
>  
>



More information about the thelist mailing list