Bug#387104: request-tracker3.4: UTF8 problems with SpeedyCGI
Package: request-tracker3.4
Version: 3.4.4-3
Severity: normal
Tags: upstream
Hi,
when using RT with SpeedyCGI, non-ascii characters are shown incorrectly
in the web interface. Although the HTTP headers specify UTF-8, the
characters are sent in ISO-8859-1. The encoding works fine with mod_perl
and FastCGI. The problem is present with both apache and apache2. I
have reproduced the issue with plain CGI as well, so SpeedyCGI itself
is clearly not at fault.
I have spent quite some time debugging this problem, and it's caused
by a difference in behaviour between HTML::Mason::CGIHandler and
HTML::Mason::ApacheHandler. The Apache version does not take the perl
internal UTF8 flag into account on output, it just prints the raw
bytes. OTOH, the CGI version uses a standard 'print' function, which
converts the data into ISO-8859-1 on output. As HTML::Mason::CGIHandler
is supposed to emulate ApacheHandler, this seems to be a bug. I'll report
it against HTML::Mason soon.
The obvious thing to try as a workaround is to put
binmode(STDOUT, ":utf8")
into mason_handler.scgi. This indeed fixes the problem, as all the
data inside RT is tagged as 'utf8' when necessary, and PerlIO converts
it on output.
There is one regression that I have noticed, though: attachments become
corrupted. It looks like the code in lib/RT/Attachment_Overlay.pm,
Content() or OriginalContent(), should be more careful with the utf8 flag.
(The same corruption happens when serving images through the Mason handler,
from html/NoAuth/images/autohandler, but that can be easily worked around.)
The problem is also present in upstream 3.4.5 and 3.6.1. I'll bring
this up on the RT mailing lists as well.
-- Package-specific info:
Changed files:
There are locally modified files in /usr/local/share/request-tracker3.4/,
these may (or may not) be the source of the problem.
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.8-3-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Versions of packages request-tracker3.4 depends on:
ii exim4 4.63-3 metapackage to ease exim MTA (v4)
ii exim4-daemon-light [mail-tra 4.63-3 lightweight exim MTA (v4) daemon
ii libapache-session-perl 1.81-1 Perl modules for keeping persisten
ii libcache-cache-perl 1.05-1 Managed caches of persistent infor
ii libcache-simple-timedexpiry- 0.26-1 Perl module to cache and expire ke
ii libclass-returnvalue-perl 0.53-1 A return-value object that lets yo
ii libdbd-mysql-perl 3.0006-1 A Perl5 database interface to the
ii libdbd-pg-perl 1.49-1 a PostgreSQL interface for Perl 5
ii libdbd-sqlite3-perl 1.12-1 Perl DBI driver with a self-contai
ii libdbi-perl 1.52-1 Perl5 database interface by Tim Bu
ii libdbix-searchbuilder-perl 1.43-1 Encapsulate SQL queries and rows i
ii libexception-class-perl 1.21-1 a module that allows you to declar
ii libfcgi-perl 0.67-2 FastCGI Perl module
ii libfreezethaw-perl 0.43-3 converting Perl structures to stri
ii libhtml-mason-perl 1:1.33-2 HTML::Mason Perl module
ii libhtml-parser-perl 3.55-1 A collection of modules that parse
ii libhtml-scrubber-perl 0.08-3 Perl extension for scrubbing/sanit
ii liblocale-maketext-fuzzy-per 0.02-2 Maketext from already interpolated
ii liblocale-maketext-lexicon-p 0.62-1 Lexicon-handling backends for "Loc
ii liblog-dispatch-perl 2.11-1 Dispatches messages to multiple Lo
ii libmailtools-perl 1.74-0.1 Manipulate email in perl programs
ii libmime-perl 5.420-0.1 Perl5 modules for MIME-compliant m
ii libmldbm-perl 2.01-1 Store multidimensional hash struct
ii libmodule-versions-report-pe 1.02-2 Report versions of all modules in
ii libparams-validate-perl 0.77-1 validate parameters to Perl method
ii libregexp-common-perl 2.120-1 Provide commonly requested regular
ii libterm-readkey-perl 2.30-3 A perl module for simple terminal
ii libtest-inline-perl 2.103-1 Perl extension for embed tests and
ii libtext-autoformat-perl 1.13-1 Perl module for automatic text wra
ii libtext-quoted-perl 1.8-2 Extract the structure of a quoted
ii libtext-template-perl 1.44-1.1 Text::Template perl module
ii libtext-wikiformat-perl 0.76-1 translates Wiki formatted text int
ii libtext-wrapper-perl 1.000-2 Simple word wrapping routine
ii libtime-modules-perl 2003.1126-2 Various Perl modules for time/date
ii libtree-simple-perl 1.16-1 A simple tree object
ii libxml-rss-perl 1.05-1 Perl module for managing RSS (RDF
ii libxml-simple-perl 2.14-4 Perl module for reading and writin
ii perl 5.8.8-6.1 Larry Wall's Practical Extraction
ii rt3.4-apache 3.4.4-3 Apache 1 specific files for reques
ii rt3.4-clients 3.4.4-3 Mail gateway and command-line inte
ii sysklogd [system-log-daemon] 1.4.1-18 System Logging Daemon
Versions of packages request-tracker3.4 recommends:
ii mysql-server 5.0.24-3 mysql database server (current ver
ii mysql-server-5.0 [mysql-serve 5.0.24-3 mysql database server binaries
-- no debconf information
Reply to: