#12447 [Opn->Bgs]: Function to encode strings for XML
| From: | chregu@php.net | Date: | Sat, 30 Nov 2002 15:20:34 +0000 |
| Subject: | #12447 [Opn->Bgs]: Function to encode strings for XML | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-26234@lists.php.net to get a copy of this message | ||
ID: 12447
Updated by: chregu@php.net
Reported By: sbergmann@php.net
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
PHP Version: 4.0.6
New Comment:
ext/recode has an XML mode. Maybe that helps (not sure about windows,
though)
chregu
Previous Comments:
------------------------------------------------------------------------
[2001-07-28 06:38:03] sbergmann@php.net
Currently I use
function &xml_encode(&$xml) {
$xml = str_replace(array('ü', 'Ü', 'ö',
'Ö', 'ä', 'Ä',
'ß'
),
array('ü', 'Ü', 'ö',
'Ö', 'ä', 'Ä',
'ß'
),
$xml
);
$xml = preg_replace(array("/\&([a-z\d\#]+)\;/i",
"/\&/",
"/\#\|\|([a-z\d\#]+)\|\|\#/i",
"/([^a-zA-Z\d\s\<\>\&\;\.\:\=\"\-\/\%\?\!\'\(\)\[\]\{\}\$\#\+\,\@_])/e"
),
array("#||\\1||#",
"&",
"&\\1;",
"'&#'.ord('\\1').';'"
),
$xml
);
return $xml;
}
to 'encode' strings for use with XML. A 'PHP Land' implementation of
this would be handy, I think.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=12447&edit=1