[Opensrf-commits] r2169 - branches/rel_2_0/src/perl/lib/OpenSRF (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Feb 22 09:42:02 EST 2011
Author: dbs
Date: 2011-02-22 09:42:00 -0500 (Tue, 22 Feb 2011)
New Revision: 2169
Modified:
branches/rel_2_0/src/perl/lib/OpenSRF/Server.pm
Log:
Resolve encoding problem found by attempting to register patrons with Unicode names
Symptoms were:
1. a gateway.log entry showing http_translator receiving an XMPP error message
2. a corresponding osrfsys.log entry "server: died with error Wide character in syswrite at /usr/local/share/perl5/OpenSRF/Server.pm line 239"
Per normal Perl Unicode handling practices, decoding input and encoding output
using the Encode module and decode_utf8() / encode_utf8() appears to resolve
the problem.
Modified: branches/rel_2_0/src/perl/lib/OpenSRF/Server.pm
===================================================================
--- branches/rel_2_0/src/perl/lib/OpenSRF/Server.pm 2011-02-22 14:28:19 UTC (rev 2168)
+++ branches/rel_2_0/src/perl/lib/OpenSRF/Server.pm 2011-02-22 14:42:00 UTC (rev 2169)
@@ -22,6 +22,7 @@
use OpenSRF::Utils::SettingsClient;
use OpenSRF::Utils::Logger qw($logger);
use OpenSRF::Transport::SlimJabber::Client;
+use Encode;
use POSIX qw/:sys_wait_h :errno_h/;
use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK);
use IO::Select;
@@ -234,8 +235,8 @@
# ----------------------------------------------------------------
sub write_child {
my($self, $child, $msg) = @_;
- my $xml = $msg->to_xml;
- syswrite($child->{pipe_to_child}, $xml);
+ my $xml = decode_utf8($msg->to_xml);
+ syswrite($child->{pipe_to_child}, encode_utf8($xml));
}
# ----------------------------------------------------------------
More information about the opensrf-commits
mailing list