]> git.donarmstrong.com Git - debbugs.git/commitdiff
encode utf8 log files
authorDon Armstrong <don@donarmstrong.com>
Mon, 19 Mar 2012 17:46:17 +0000 (10:46 -0700)
committerDon Armstrong <don@donarmstrong.com>
Mon, 19 Mar 2012 17:46:17 +0000 (10:46 -0700)
Debbugs/Log.pm

index af80f7ab5e6f5d86b734bb27a6612f71e738ebf4..a28384de59bd5ddaf9ce41d8b32f7b8dbd504779 100644 (file)
@@ -39,6 +39,7 @@ use Carp;
 
 use Debbugs::Common qw(getbuglocation getbugcomponent make_list);
 use Params::Validate qw(:types validate_with);
+use Encode qw(encode);
 
 =head1 NAME
 
@@ -426,7 +427,7 @@ Applies the log escape regex to the passed logfile.
 
 sub escape_log {
        my @log = @_;
-       return map { s/^([\01-\07\030])/\030$1/gm; $_ } @log;
+       return map { eval {$_ = encode("utf8",$_,Encode::FB_CROAK)}; s/^([\01-\07\030])/\030$1/gm; $_ } @log;
 }