From: Don Armstrong Date: Sun, 8 Jul 2012 03:01:02 +0000 (-0700) Subject: only encode to utf8 if is_utf8 is set; otherwise the string is assumed to already... X-Git-Tag: release/2.6.0~377 X-Git-Url: https://git.donarmstrong.com/?p=debbugs.git;a=commitdiff_plain;h=46b3fa0d41486df933a92220b270c74f2204cdf4 only encode to utf8 if is_utf8 is set; otherwise the string is assumed to already be utf8 in escape_log --- diff --git a/Debbugs/Log.pm b/Debbugs/Log.pm index a28384d..20e1350 100644 --- a/Debbugs/Log.pm +++ b/Debbugs/Log.pm @@ -39,7 +39,7 @@ use Carp; use Debbugs::Common qw(getbuglocation getbugcomponent make_list); use Params::Validate qw(:types validate_with); -use Encode qw(encode); +use Encode qw(encode is_utf8); =head1 NAME @@ -427,7 +427,7 @@ Applies the log escape regex to the passed logfile. sub escape_log { my @log = @_; - return map { eval {$_ = encode("utf8",$_,Encode::FB_CROAK)}; s/^([\01-\07\030])/\030$1/gm; $_ } @log; + return map { eval {$_ = is_utf8($_)?encode("utf8",$_,Encode::FB_CROAK):$_;}; s/^([\01-\07\030])/\030$1/gm; $_ } @log; }