After updating to the most recent version of RPC::XML my applications broke. It looks like RPC::XML::Client is sending bad UTF-8 data.
I was using the *RPC::XML::utf8_downgrade = \&utf8::encode; hack but the recent RPC::XML updates made it useless.
*RPC::XML::utf8_downgrade = \&utf8::encode;
Digging in the code, I noticed that RPC::XML::Client uses utf8::downgrade() to encode request data. After changing it to utf8::encode() everything is working again.
To check whether this change is good or not, I put these lines after the original call to utf8::downgrade():
# Treat the content strictly in-memory
utf8::downgrade($content = $req->as_string);
open my $fh, ">", "foo.txt";
print $fh $content;
Inspecting the resulting file with a text editor showed that the file doesn't include UTF-8 octects but 8-bit data. After the change to utf8::encode() the file actually contained valid UTF-8 text.
I only replaced utf8::downgrade() in the place that affected my applications, but I see there are other occurrences in the module files. You might want to check whether it should be there or not.
Use utf8::encode() instead of utf8::downgrade()
Replace utf8::downgrade() with utf8::encode() in length() too
Amazing, that seems to fix my UTF-8 RPC::XML::Client issue as well. Alessandro, thanks for the patch! Ryan, any chance to apply this patch?
@rjray, any chance you can give some attention to this? The module has been broken for quite some time.
@alexrj, I am sorry for the lengthy delay in this. I have been having health issues that have greatly reduced my time and energy for Perl work beyond my day-job. I will look at this very soon, and unless I find a problem in any of my tests, I will merge it for the 0.78 release that I hope to have out soon.
OK, this is now merged. I noticed that this only changes utf8::downgrade to utf8::encode in two places, when there are several more in RPC::XML and one in RPC::XML::Server as well. I will do a follow-up commit to the code that catches these other occurrences.
Sorry about your health issues, I hope everything is fine now. Thank you for merging!