X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Debbugs%2FStatus.pm;h=d44d0bdea277da4add795748ab9c200cabafc3b1;hb=73937d35513a2fc3cb249dec379ce4e6db3c5979;hp=e70643fbe6244f86c799b9149e4fc44e51a653bf;hpb=cb2d3bceada187525f182c9ea7c7d4f5e93fefce;p=debbugs.git diff --git a/Debbugs/Status.pm b/Debbugs/Status.pm index e70643f..d44d0bd 100644 --- a/Debbugs/Status.pm +++ b/Debbugs/Status.pm @@ -45,6 +45,7 @@ use Debbugs::Versions; use Debbugs::Versions::Dpkg; use POSIX qw(ceil); use File::Copy qw(copy); +use Encode qw(decode encode); use Storable qw(dclone); use List::Util qw(min max); @@ -239,6 +240,9 @@ sub read_bug{ my %namemap = reverse %fields; for my $line (@lines) { + eval { + $line = decode("utf8",$line,Encode::FB_CROAK); + }; if ($line =~ /(\S+?): (.*)/) { my ($name, $value) = (lc $1, $2); # this is a bit of a hack; we should never, ever have \r @@ -547,12 +551,8 @@ sub new_bug { close $nn_fh; overwritefile("nextnumber", ($nn+1)."\n"); + unfilelock(); my $nn_hash = get_hashname($nn); - use IO::File; - my $t_fh = IO::File->new("/home/don/temp.txt",'a') or die "Unable to open ~don/temp.txt for writing: $!"; - use Data::Dumper; - print {$t_fh} Dumper({%param,nn => $nn, nn_hash => $nn_hash, nextnumber => qx(cat nextnumber)}); - close $t_fh; if ($param{copy}) { my $c_hash = get_hashname($param{copy}); for my $file (qw(log status summary report)) { @@ -640,11 +640,14 @@ sub makestatus { # Output field names in proper case, e.g. 'Merged-With'. my $properfield = $fields{$field}; $properfield =~ s/(?:^|(?<=-))([a-z])/\u$1/g; - $contents .= "$properfield: $newdata{$field}\n"; + my $data = $newdata{$field}; + $contents .= "$properfield: $data\n"; } } } - + eval { + $contents = encode("utf8",$contents,Encode::FB_CROAK); + }; return $contents; }