[phpxmlrpc] Special special chars in XML Response

Matthias Korn korn at prometa.de
Tue Sep 18 11:21:57 BST 2007


Hi Gaetano,

thank you for your fast reply and advice! I implemented the steps as you 
described, but when setting 
$GLOBALS['xmlrpc_internalencoding']='CP1252'; I am now getting the 
following error:

Warning:  xml_parser_set_option() [function.xml-parser-set-option]: 
Unsupported target encoding "CP1252" in 
...\module_xmlrpc\lib\xmlrpcs.inc on line 922

The PHP documentation says the only support ISO-8859-1, US-ASCII and 
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  
> charset, aka, cp 1252.
> There is no support for that right now, but it is quite is easy to add 
> it:
>
> in xmlrpc.inc, on line  152,  an array is already defined with the 
> necessary translation. Using array_keys() and array_values() on it, 
> you can modify function xmlrpc_encode_entitites(), adding a new case:
> case 'CP1252_US-ASCII':
>                $escaped_data = str_replace(array('&', '"', "'", '<', 
> '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
>                $escaped_data = 
> str_replace($GLOBALS['xml_iso88591_Entities']['in'], 
> $GLOBALS['xml_iso88591_Entities']['out'], $escaped_data);
>                $escaped_data = 
> str_replace(array_keys(array_keys($GLOBALS['$cp1252_to_xmlent'])), 
> 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 
> patched...
>
> bye
> Gaetano
>
>> Hi,
>>
>> I have an encoding problem of some sort. The data (strings) I'm 
>> sending through xmlresp contains some really nasty characters (e.g. • 
>> „ “ …) and breaks the XML parser on the client side. Most of the 
>> characters get automatically converted to their corresponding XML 
>> entities by you library, but not those listed above.
>>
>> How can I convert them so that my XML parser doesn't break? (I can 
>> verify it's broken in Internet Explorer, which probably uses the same 
>> parser)
>>
>>
>> Best regards,
>> Matthias Korn
>> _______________________________________________
>> phpxmlrpc mailing list
>> phpxmlrpc at lists.usefulinc.com
>> http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc
>>
>


-- 
Mit freundlichen Grüßen,

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äftsführer
 Dipl.-Ing. Marc Staiger

Handelsregister
 HRB7776 Amtsgericht Siegen

http://www.prometa.de
http://www.infotrax.de
----------------------------------------



More information about the phpxmlrpc mailing list