On Fri, Jan 30, 2009 at 12:41:19PM -0500, Martin Kutter via RT wrote:
Show quoted text> <URL:
http://rt.cpan.org/Ticket/Display.html?id=42915 >
>
> Hi Emmanuel,
>
> sorry, I don't understand what you're trying to do and what went wrong.
> Could you please explain in more detail, preferably with some code
> example and error message (if any)?
>
I'm going to try ;)
I discovered the problem when trying to use XMLRPC::Lite in our RT to access
our XMLRPC service (which uses php pear classes).
I have a perl variable comming from some call of RT API that give me an
utf-8 string out of the DB: $inter_desc.
I want to send it to my webservice:
my $result = XMLRPC::Lite
-> proxy($RT::WsURL.'contracts.php')
-> call('contracts.invoice', $login, $contract_id, $inter_id, $inter_index, $resolved_date, $time_worked, $inter_desc, $ticket_id)
-> result;
XMLRPC::Lite try to send the $inter_desc which contains the utf-8 string as
base64 (why not ;)). On the XMLRPC server side, after base64 decoding, the
string is ISO8859-1!!!
After many testing, I discovered that an is_utf8 on $time_worked returns 1 for
this code and 0 in another standalone script which works.
So I tried adding:
Encode::_utf8_off($inter_desc);
before XMLRPC::Lite call.
and now it works, the string on the server side is received as utf-8.
I looked in SOAP::Lite code, and saw that the method as_base64 in SOAP/Lite.pm
as some fix related to this. But in XMLRPC/Lite.pm, there is a dedicated
as_base64 method (so the one from SOAP/Lite.pm is not used with XMLRPC) which
don't have this fix.
Is it a bit more understandable? ;)