[phpxmlrpc] Accents in phpxmlrpc

Gaetano Giunta giunta.gaetano at sea-aeroportimilano.it
Mon Feb 6 16:06:22 GMT 2006


The most likely cause is your web-service server NOT putting a correct charset specification in the HTTP headers that accompany the xmlrpc response you pasted below. There is no charset specification in the xml prologue (the <?xml ?> tag) of the response, either.
As per the HTTP standard, if you do not specify a charset, for content of type text/*, such as xmlrpc is, the assumed charset MUST be US-ASCII.
Lots of libraries break the spec, and the phpxmlrpc lib by defaults assumes that, when unspecified, the charset used by the partner is UTF-8.

If the xml parsing broke on your request, you are most likely not using UTF-8.
You are not using ASCII, either, because there are no accented chars in ascii ;)
My best guess is you are using ISO-8859-1, which is, luckily, pretty well supported by phpxmlrpc.

You should either:

1 - modify the server code to have it specify a correct charset, either in the HTTP headers or the xml prologue, or

2 - modify the server code to emit UTF-8 encoded data, or

3 - change one line of code in your php client:
after having included the xmlrpc.inc file, set
$GLOBALS['xmlrpc_defencoding']='ISO-8859-1'

If method 3 does not work, there might be some other problems I cannot decipher without a screen dump of the client debug mode.

Bye
Gaetano
  -----Original Message-----
  From: phpxmlrpc-bounces at lists.usefulinc.com [mailto:phpxmlrpc-bounces at lists.usefulinc.com]On Behalf Of Overpeer ---
  Sent: Monday, February 06, 2006 4:21 PM
  To: phpxmlrpc at lists.usefulinc.com
  Subject: [phpxmlrpc] Accents in phpxmlrpc


  Hello.

  Some of my functions return a accents vocals like 'á' or 'é' for example, then the phpxmlrpc return a error:

  Fault: Code: 2 Reason 'Invalid return payload: enable debugging to examine incoming payload (XML error: not well-formed (invalid token) at line 16)'

  The invalid token apperas always, when a accent vocal is in the return string, like this:

  <?xml version="1.0"?>
  <methodResponse>
     <params>
     <param>
  <value>
    <array>
      <data>
  <value>
    <struct>
      <member>
        <name>FECHA</name>
        <value><dateTime.iso8601>20060206T15:17:40</dateTime.iso8601></value>
      </member>
      <member>
        <name>TIPO</name>
        <value><string>Incidencia genérica</string></value>   <----- Line 16
  [...]


  How i can view this specials characters ???

  A lot of thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.gnomehack.com/pipermail/phpxmlrpc/attachments/20060206/caccf7ed/attachment.htm


More information about the phpxmlrpc mailing list