Re: Special special chars in XML Response
Matthias Korn <[email protected]> Tue, 18 Sep 2007 12:21:57 +0200
| Newsgroups | gmane.comp.php.xml-rpc |
|---|---|
| Organization | ProMeta - InfotraX GmbH |
| Message-ID | <[email protected]> |
Hi Gaetano,
thank you for your fast reply and advice! I implemented the steps as you=20
described, but when setting=20
$GLOBALS['xmlrpc_internalencoding']=3D'CP1252'; I am now getting the=20
following error:
Warning: xml_parser_set_option() [function.xml-parser-set-option]:=20
Unsupported target encoding "CP1252" in=20
...\module_xmlrpc\lib\xmlrpcs.inc on line 922
The PHP documentation says the only support ISO-8859-1, US-ASCII and=20
UTF-8: http://de3.php.net/xml_parser_set_option
How can I further tackle this issue?
Thanks and best regards,
Matthias Korn
Gaetano Giunta schrieb:
> The characters you are sending are very likely part of the windows =20
> charset, aka, cp 1252.
> There is no support for that right now, but it is quite is easy to add=20
> it:
>
> in xmlrpc.inc, on line 152, an array is already defined with the=20
> necessary translation. Using array_keys() and array_values() on it,=20
> you can modify function xmlrpc_encode_entitites(), adding a new case:
> case 'CP1252_US-ASCII':
> $escaped_data =3D str_replace(array('&', '"', "'", '<',=20
> '>'), array('&', '"', ''', '<', '>'), $data);
> $escaped_data =3D=20
> str_replace($GLOBALS['xml_iso88591_Entities']['in'],=20
> $GLOBALS['xml_iso88591_Entities']['out'], $escaped_data);
> $escaped_data =3D=20
> str_replace(array_keys(array_keys($GLOBALS['$cp1252_to_xmlent'])),=20
> array_values($GLOBALS['$cp1252_to_xmlent']), $escaped_data);
> break;
>
> then of course you have to declare your internal encoding as CP1252
> ... and maybe check out if there is any decoding function to be=20
> patched...
>
> bye
> Gaetano
>
>> Hi,
>>
>> I have an encoding problem of some sort. The data (strings) I'm=20
>> sending through xmlresp contains some really nasty characters (e.g. =E2=
=80=A2=20
>> =E2=80=9E =E2=80=9C =E2=80=A6) and breaks the XML parser on the client=
side. Most of the=20
>> characters get automatically converted to their corresponding XML=20
>> entities by you library, but not those listed above.
>>
>> How can I convert them so that my XML parser doesn't break? (I can=20
>> verify it's broken in Internet Explorer, which probably uses the same=20
>> parser)
>>
>>
>> Best regards,
>> Matthias Korn
>> _______________________________________________
>> phpxmlrpc mailing list
>> [email protected]
>> http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc
>>
>
--=20
Mit freundlichen Gr=C3=BC=C3=9Fen,
Matthias Korn
----------------------------------------
I n f o t r a X G m b H
Fon +49 (0)271 30 30 888
Fax +49 (0)271 74124-77
Mob +49 (0)176 700 17 17 8
Besuchsadresse: Postadresse:
Hindenburgstrasse 11 Setzer Weg 29
57072 Siegen 57076 Siegen
Gesch=C3=A4ftsf=C3=BChrer
Dipl.-Ing. Marc Staiger
Handelsregister
HRB7776 Amtsgericht Siegen
http://www.prometa.de
http://www.infotrax.de
----------------------------------------