my $buglog = buglog($ref);
if ($ENV{REQUEST_METHOD} eq 'HEAD' and not defined($att) and not $mbox) {
- print "Content-Type: text/html\n";
+ print "Content-Type: text/html; charset=utf-8\n";
my @stat = stat $buglog;
if (@stat) {
my $mtime = strftime '%a, %d %b %Y %T GMT', gmtime($stat[9]);
$filename = '' unless defined $filename;
if ($top) {
- $$this .= htmlsanit($entity->stringify_header) unless ($terse);
+ $$this .= htmlsanit(decode_rfc1522($entity->stringify_header))
+ unless ($terse);
$$this .= "\n";
}
my %status = %{getbugstatus($ref)};
unless (%status) {
print <<EOF;
-Content-Type: text/html
+Content-Type: text/html; charset=utf-8
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
print join("", @mails );
exit 0;
}
-print "Content-Type: text/html\n\n";
+print "Content-Type: text/html; charset=utf-8\n\n";
my $title = htmlsanit($status{subject});
require "$lib_path/errorlib";
use Debbugs::Versions;
+use Debbugs::MIME qw(decode_rfc1522);
$MLDBM::RemoveTaint = 1;
use vars qw($gPackagePages $gWebDomain);
if (defined $ENV{REQUEST_METHOD} and $ENV{REQUEST_METHOD} eq 'HEAD') {
- print "Content-Type: text/html\n\n";
+ print "Content-Type: text/html; charset=utf-8\n\n";
exit 0;
}
my $result = htmlizebugs(\@bugs);
-print "Content-Type: text/html\n\n";
+print "Content-Type: text/html; charset=utf-8\n\n";
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
print "<HTML><HEAD>\n" .
- Add X-$gProject-PR-Message: headers to all mails sent by service.
- debbugsconfig creates required directories in $gSpoolDir
(closes: #222077).
+ - Decode RFC1522 mail headers for display in the web interface.
+ bugreport.cgi and pkgreport.cgi now output UTF-8.
* Adam Heath:
- Rewrite filtering in cgi's common.pl, to make it completely generic.
# -*- perl -*-
-# $Id: errorlib.in,v 1.41 2004/02/15 16:12:00 cjwatson Exp $
+# $Id: errorlib.in,v 1.42 2005/04/09 16:21:02 cjwatson Exp $
use Mail::Address;
+use Debbugs::MIME qw(decode_rfc1522 encode_rfc1522);
sub F_SETLK { 6; } sub F_WRLCK{ 1; }
$flockstruct= 'sslll'; # And there ought to be something for this too.
owner => 'owner',
);
+# Fields which need to be RFC1522-decoded in format versions earlier than 3.
+my @rfc1522_fields = qw(originator subject done forwarded owner);
+
sub readbug {
my ($lref, $location) = @_;
my $status = getbugcomponent($lref, 'summary', $location);
$version = $1 if /^Format-Version: ([0-9]+)/i;
}
- # Version 2 is the latest format version currently supported.
- return undef if $version > 2;
+ # Version 3 is the latest format version currently supported.
+ return undef if $version > 3;
my %namemap = reverse %fields;
for my $line (@lines) {
$data{severity} = 'normal' if $data{severity} eq '';
+ if ($version < 3) {
+ for my $field (@rfc1522_fields) {
+ $data{$field} = decode_rfc1522($data{$field});
+ }
+ }
+
return \%data;
}
my $contents = '';
+ my %newdata = %$data;
+ if ($version < 3) {
+ for my $field (@rfc1522_fields) {
+ $newdata{$field} = encode_rfc1522($newdata{$field});
+ }
+ }
+
if ($version == 1) {
for my $field (@v1fieldorder) {
- if (exists $data->{$field}) {
- $contents .= "$data->{$field}\n";
+ if (exists $newdata{$field}) {
+ $contents .= "$newdata{$field}\n";
} else {
$contents .= "\n";
}
}
- } elsif ($version == 2) {
- # Version 2. Add a file format version number for the sake of
+ } elsif ($version == 2 or $version == 3) {
+ # Version 2 or 3. Add a file format version number for the sake of
# further extensibility in the future.
- $contents .= "Format-Version: 2\n";
+ $contents .= "Format-Version: $version\n";
for my $field (keys %fields) {
- if (exists $data->{$field} and $data->{$field} ne '') {
+ if (exists $newdata{$field} and $newdata{$field} ne '') {
# Output field names in proper case, e.g. 'Merged-With'.
my $properfield = $fields{$field};
$properfield =~ s/(?:^|(?<=-))([a-z])/\u$1/g;
- $contents .= "$properfield: $data->{$field}\n";
+ $contents .= "$properfield: $newdata{$field}\n";
}
}
}
#!/usr/bin/perl
-# $Id: process.in,v 1.88 2005/01/02 19:08:12 cjwatson Exp $
+# $Id: process.in,v 1.89 2005/04/09 16:21:02 cjwatson Exp $
#
# Usage: process nn
# Temps: incoming/Pnn
tzset();
use MIME::Parser;
+use Debbugs::MIME qw(decode_rfc1522);
$config_path = '/etc/debbugs';
$lib_path = '/usr/lib/debbugs';
if (s/^(\S+):\s*//) {
my $v = lc $1;
print DEBUG ">$v=$_<\n";
- $header{$v} = $_;
+ $header{$v} = decode_rfc1522($_);
} else {
print DEBUG "!>$_<\n";
}
#!/usr/bin/perl
-# $Id: service.in,v 1.98 2005/03/15 21:40:41 cjwatson Exp $
+# $Id: service.in,v 1.99 2005/04/09 16:21:02 cjwatson Exp $
#
# Usage: service <code>.nn
# Temps: incoming/P<code>.nn
use File::Copy;
use MIME::Parser;
+use Debbugs::MIME qw(decode_rfc1522);
$config_path = '/etc/debbugs';
$lib_path = '/usr/lib/debbugs';
if (s/^(\S+):\s*//) {
my $v = lc $1;
print ">$v=$_<\n" if $debug;
- $header{$v} = $_;
+ $header{$v} = decode_rfc1522($_);
} else {
print "!>$_<\n" if $debug;
}