note 90013 added to function.wddx-deserialize
| From: | valerunderscorecrisanatyahoo at osu1 dot php dot net | Date: | Wed, 01 Apr 2009 22:03:09 +0000 |
| Subject: | note 90013 added to function.wddx-deserialize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152727@lists.php.net to get a copy of this message | ||
In PHP 5.2.9, we noticed that wddx serialize and deserialize seems to use UTF-8 encoding for XML
input and the output data. There are some posts below that talk about fixing the input XML data so
deserialize would work fine on special chars in ISO-8859-1 encoding, but none of the posts talks
about the output encoding.
Consider this test:
$text = "Jür";
$packet = wddx_serialize_value($text);
$header = '<?xml version="1.0" encoding="iso-8859-1"?>';
$newText = wddx_deserialize($header . $packet);
echo "WDDX Packet: $packet\n";
echo "Deserialized Object: $newText\n";
The output is:
WDDX Packet: <wddxPacket
version='1.0'><header/><data><string>Jür</string></data></wddxPacket>
Deserialized Object: Jür
The deserialized string is not in ISO-8859-1 encoding. It is in UTF-8 encoding. So we need to run
utf8_decode() on the deserialized data to convert it back to ISO-8859-1 encoding which is what our
application expects.
Hope this helps.
----
Server IP: 208.69.120.35
Probable Submitter: 216.132.93.103
----
Manual Page -- http://www.php.net/manual/en/function.wddx-deserialize.php
Edit -- https://master.php.net/note/edit/90013
Del: integrated -- https://master.php.net/note/delete/90013/integrated
Del: useless -- https://master.php.net/note/delete/90013/useless
Del: bad code -- https://master.php.net/note/delete/90013/bad+code
Del: spam -- https://master.php.net/note/delete/90013/spam
Del: non-english -- https://master.php.net/note/delete/90013/non-english
Del: in docs -- https://master.php.net/note/delete/90013/in+docs
Del: other reasons-- https://master.php.net/note/delete/90013
Reject -- https://master.php.net/note/reject/90013
Search -- https://master.php.net/manage/user-notes.php