From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Cc: Jan Engelhardt <jengelh@medozas.de>,
Lea Wiemann <lewiemann@gmail.com>,
Jakub Narebski <jnareb@gmail.com>
Subject: [PATCH] gitweb: Add charset info to "raw" blob output
Date: Sat, 31 May 2008 13:27:01 +0200 [thread overview]
Message-ID: <20080531112513.30913.44393.stgit@localhost.localdomain> (raw)
In-Reply-To: <m3tzgg1a06.fsf@localhost.localdomain>
Always add charset info from $default_text_plain_charset (if it is
defined) to "raw" (a=blob_plain) output for 'text/plain' blobs.
Adding charset info in a special case was removed from blob_mimetype().
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Please note that to have utf-8 for 'text/plain' blobs in blob_plain
view ("raw" output) you still have to set $default_text_plain_charset
to 'utf-8' (in gitweb configuration file).
gitweb/gitweb.perl | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 57a1905..dd0f0ac 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2481,8 +2481,7 @@ sub blob_mimetype {
return $default_blob_plain_mimetype unless $fd;
if (-T $fd) {
- return 'text/plain' .
- ($default_text_plain_charset ? '; charset='.$default_text_plain_charset : '');
+ return 'text/plain';
} elsif (! $filename) {
return 'application/octet-stream';
} elsif ($filename =~ m/\.png$/i) {
@@ -4397,6 +4396,9 @@ sub git_blob_plain {
or die_error(undef, "Couldn't cat $file_name, $hash");
$type ||= blob_mimetype($fd, $file_name);
+ if ($type eq 'text/plain' && defined $default_text_plain_charset) {
+ $type .= "; charset=$default_text_plain_charset";
+ }
# save as filename, even when no $file_name is given
my $save_as = "$hash";
next prev parent reply other threads:[~2008-05-31 11:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-28 18:04 gitweb forgets to send utf8 header for raw blob views Jan Engelhardt
2008-05-29 11:32 ` Lea Wiemann
2008-05-30 8:18 ` Jakub Narebski
2008-05-31 11:27 ` Jakub Narebski [this message]
2008-05-31 18:22 ` [PATCH] gitweb: Add charset info to "raw" blob output Junio C Hamano
2008-06-01 11:06 ` Jakub Narebski
2008-06-01 12:15 ` Jan Engelhardt
2008-06-01 12:16 ` Jan Engelhardt
2008-06-03 14:47 ` [PATCH v2] gitweb: Add charset info to "raw" output of 'text/plain' blobs Jakub Narebski
2008-05-31 15:04 ` gitweb forgets to send utf8 header for raw blob views Jan Engelhardt
2008-05-31 22:39 ` Jakub Narebski
2008-06-01 2:08 ` Jan Engelhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080531112513.30913.44393.stgit@localhost.localdomain \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=jengelh@medozas.de \
--cc=lewiemann@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).