Re: DOM - Question about \0

From: Date: Sun, 16 Mar 2008 19:53:21 +0000
Subject: Re: DOM - Question about \0
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-271665@lists.php.net to get a copy of this message
dav wrote:
Hi, I have question about \0 character with DOM :
<snip />
What to do with the character \0 ? encode this character to obtain : <![CDATA[foo&00;bar]]> ? or skip the character with str_replace("\0", '', $cdata) ?
CDATA is raw data and why it doesnt get magically encoded. If you remove the character then you are altering the raw data - also not a good thing typically.
What is the best thing to do ? i like to conserve the \0 because is a blob data Jabber is how to transmit binary ?
Never use CDATA sections. blob data should always be base64 encoded (or some other encoding). The data can then be transmitted in a regular element. Note that it is possible that your blob data can contain the following sequence of characters "]]>" which would effectively terminate the CDATA block even though there really is more data. Rob

« previous php.general (#271665) next »