Package: git
Version: 1:1.7.10.4-1+wheezy1
Severity: normal
Tags: patch
Hi *,
gitweb uses p5-CGI which, according to its perldoc, defaults
to latin1 if no charset is given. This causes mojibake:
$ env GATEWAY_INTERFACE=CGI/1.1 REQUEST_METHOD=GET \
REQUEST_URI=/gitweb/ SERVER_PROTOCOL=HTTP/1.0 \
QUERY_STRING='p=verein;a=blob_plain;f=projects/assorted/skolelinux-neujahrstreffen-2014.md;hb=HEAD'
\
/usr/share/gitweb/index.cgi | head
Content-disposition: inline;
filename="projects/assorted/skolelinux-neujahrstreffen-2014.md"
Content-Type: text/plain; charset=ISO-8859-1
Skolelinux-Neujahrstreffen 2014
[…]
The file itself contains correct UTF-8 plaintext (no encoding
errors in it) and is served octet-correct, but the HTTP response
header wrongly indicates latin1 encoding for it.
The correct fix here is to prevent p5-CGI from adding any charset
if none was already given (e.g. via guess_mimetype). Patch attached.
I’ve checked git 1:1.8.5.2-1 (sid), and it has the same bug.
-- System Information:
Debian Release: 7.3
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages git depends on:
ii git-man 1:1.7.10.4-1+wheezy1
ii libc6 2.13-38
ii libcurl3-gnutls 7.26.0-1+wheezy7
ii liberror-perl 0.17-1
ii libexpat1 2.1.0-1+deb7u1
ii perl-modules 5.14.2-21+deb7u1
ii zlib1g 1:1.2.7.dfsg-13
Versions of packages git recommends:
ii less 444-4
ii openssh-client [ssh-client] 1:6.0p1-4
ii patch 2.6.1-3
ii rsync 3.0.9-4
Versions of packages git suggests:
ii gettext-base 0.18.1.1-9
pn git-arch <none>
pn git-cvs <none>
pn git-daemon-run | git-daemon-sysvinit <none>
pn git-doc <none>
pn git-el <none>
pn git-email <none>
pn git-gui <none>
pn git-svn <none>
pn gitk <none>
ii gitweb 1:1.7.10.4-1+wheezy1
-- no debconf information
--- /usr/share/gitweb/index.cgi 2012-11-24 08:03:07.000000000 +0100
+++ index.cgi 2014-01-05 16:26:34.049017232 +0100
@@ -6752,6 +6752,7 @@ sub git_blob_plain {
print $cgi->header(
-type => $type,
+ -charset => '',
-expires => $expires,
-content_disposition =>
($sandbox ? 'attachment' : 'inline')