From 9f70287410fd7b72c8aded14b1335db57b55e6a5 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Fri, 17 Jun 2011 13:50:26 -0400 Subject: [PATCH] encode to UTF8 consistently In read_SIP_packet(), we decode the incoming packet as UTF8 and then encode it again before writing to the log, but not before returning the message. We were instead encoding the incoming message in a subsequent call, which is not the recommended Perl practice of decoding input and encoding output. Signed-off-by: Dan Scott --- Sip.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sip.pm b/Sip.pm index 1e57916..42c6e02 100644 --- a/Sip.pm +++ b/Sip.pm @@ -209,7 +209,7 @@ sub read_SIP_packet { # # This is now handled by the vigorous cleansing above. syslog("LOG_INFO", encode_utf8("INPUT MSG: '$record'")) if $record; - return $record; + return encode_utf8($record); } # @@ -227,7 +227,6 @@ sub write_msg { my ($self, $msg, $file) = @_; my $cksum; - $msg = encode_utf8($msg); if ($error_detection) { if (defined($self->{seqno})) { $msg .= 'AY' . $self->{seqno}; -- 2.11.0