]> git.donarmstrong.com Git - debbugs.git/commitdiff
only encode to utf8 if is_utf8 is set; otherwise the string is assumed to already...
authorDon Armstrong <don@donarmstrong.com>
Sun, 8 Jul 2012 03:01:02 +0000 (20:01 -0700)
committerDon Armstrong <don@donarmstrong.com>
Sun, 8 Jul 2012 03:01:02 +0000 (20:01 -0700)
Debbugs/Log.pm

index a28384de59bd5ddaf9ce41d8b32f7b8dbd504779..20e13503441df9521913a4ed7308e8c0a21ea08e 100644 (file)
@@ -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;
 }