Try base64_(en|de)code.

-Stathis.

Christopher Heschong wrote:
> 
> Despite the fact that PHP's WDDX functions don't support a "binary" type,
> most binary data comes through just fine, and in fact, the WDDX serialize
> function can encode certain types of binary data, such as a null
> character: <char code='00'/>
> 
> But the deserialize process dos not retain these characters.  Is this a
> bug in PHP's implementation of WDDX, or is there perhaps a workaround
> available?
> 
> Here's some example code that shows a WDDX packet of encoded binary data.
> The packet itself contains all of the binary data, including null
> characters, etc.  The deserialized() string, however, does not.
> 
> <?php
> 
> $fp = fopen("http://www.php.net/gifs/php_logo.gif","r");
> while (!feof($fp)) {
>  $str .= fread($fp, 4096);
> }
> 

$str = base64_encode($str);

> $packet = wddx_serialize_value($str, "php_logo.gif");
> 
> Header("Content-Type: image/gif");
> 
> $str = wddx_deserialize($packet);

$str = base64_decode($str);

> 
> echo $str;
> 
> ?>
> 
> --
> /chris/
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to