From: Max Kanat-Alexander Date: Sun, 28 Mar 2010 21:06:09 +0000 (-0700) Subject: Bug 365926: Serve attachments without an explicit charset, and let the browser X-Git-Tag: bugzilla-3.6~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e8167c938be6f0c649652b745de3b195312c467;p=thirdparty%2Fbugzilla.git Bug 365926: Serve attachments without an explicit charset, and let the browser decide which charset to use r=LpSolit, a=LpSolit --- diff --git a/attachment.cgi b/attachment.cgi index 0181f8cad7..f85fb3a19e 100755 --- a/attachment.cgi +++ b/attachment.cgi @@ -329,6 +329,14 @@ sub view { my $disposition = Bugzilla->params->{'allow_attachment_display'} ? 'inline' : 'attachment'; + # Don't send a charset header with attachments--they might not be UTF-8. + # However, we do allow people to explicitly specify a charset if they + # want. + if ($contenttype !~ /\bcharset=/i) { + # In order to prevent Apache from adding a charset, we have to send a + # charset that's a single space. + $cgi->charset(' '); + } print $cgi->header(-type=>"$contenttype; name=\"$filename\"", -content_disposition=> "$disposition; filename=\"$filename\"", -content_length => $attachment->datasize);