git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yasushi SHOJI <yashi@atmark-techno.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Cc: Jakub Narebski <jnareb@gmail.com>
Cc: "Ismail Dönmez" <ismail@pardus.org.tr>
Subject: Re: [PATCH] gitweb: convert from perl internal to utf8 for commitdiff_plain
Date: Tue, 29 Jan 2008 21:16:02 +0900	[thread overview]
Message-ID: <87ejc0j08t.wl@mail2.atmark-techno.com> (raw)
In-Reply-To: <7vejc1qium.fsf@gitster.siamese.dyndns.org>

At Mon, 28 Jan 2008 21:52:17 -0800,
Junio C Hamano wrote:
> 
> Yasushi SHOJI <yashi@atmark-techno.com> writes:
> 
> > At Mon, 28 Jan 2008 21:39:27 -0800,
> > Junio C Hamano wrote:
> >> 
> >> Yasushi SHOJI <yashi@atmark-techno.com> writes:
> >> 
> >> > This patch effectively revert the commitdiff plain part of the commit
> >> >
> >> > 	59b9f61a3f76762dc975e99cc05335a3b97ad1f9
> >> >
> >> > which converted from print to here-doc. but it doesn't
> >> > explain why in the commit log.
> >> 
> >> I think the patch makes sense but the above is misleading.  Read
> >> it again.
> >> 
> >> Doesn't it sound like you are accusing that 59b9f61a introduced
> >> a regression when it converted existsing "print utf8()" to
> >> "print <<here-doc" without saying that is what it is doing?
> >
> > sorry about my stupid english.  What I meant was that because commit
> > log doesn't say _why_ it changed to here-doc, I couldn't be sure it
> > was ok to overwrite the change introduced by the commit 59b9f61a3.
> >
> > IOW, I was tring to ask, "is it ok to revert back to print?"
> 
> Sure.  Can I forge your Sign-off?

From 127a6abaf23991394b3b2c5455c2522f9da1e8ac Mon Sep 17 00:00:00 2001
From: Yasushi SHOJI <yashi@wat.atmark-techno.com>
Date: Tue, 29 Jan 2008 20:48:33 +0900
Subject: [PATCH] gitweb: Convert generated contents to utf8 in commitdiff_plain
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

If the commit message, or commit author contains non-ascii, it must be
converted from Perl internal representation to utf-8, to follow what
got declared in HTTP header.  Use to_utf8() to do the conversion.

This necessarily replaces here-doc with "print" statements.

Signed-off-by: Yasushi SHOJI <yashi@atmark-techno.com>
Acked-by: İsmail Dönmez <ismail@pardus.org.tr>
Acked-by: Jakub Narebski <jnareb@gmail.com>
---

Jakub, thanks for much better commit log.  I just copy & pasted to new
commit.

One thing I've changed from the last patch was, as Jakub and Ismail
pointed out, the Date line.  I've:

 - removed to_utf8(), and
 - made it one line

I also noticed that I've removed parentheses from the line by
accident, so I put them back.

Junio, please use this if you are ok.

Thanks,



 gitweb/gitweb.perl |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 6256641..80e3d0a 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5048,16 +5048,15 @@ sub git_commitdiff {
 			-expires => $expires,
 			-content_disposition => 'inline; filename="' . "$filename" . '"');
 		my %ad = parse_date($co{'author_epoch'}, $co{'author_tz'});
-		print <<TEXT;
-From: $co{'author'}
-Date: $ad{'rfc2822'} ($ad{'tz_local'})
-Subject: $co{'title'}
-TEXT
+		print "From: " . to_utf8($co{'author'}) . "\n";
+		print "Date: $ad{'rfc2822'} ($ad{'tz_local'})\n";
+		print "Subject: " . to_utf8($co{'title'}) . "\n";
+
 		print "X-Git-Tag: $tagname\n" if $tagname;
 		print "X-Git-Url: " . $cgi->self_url() . "\n\n";
 
 		foreach my $line (@{$co{'comment'}}) {
-			print "$line\n";
+			print to_utf8($line) . "\n";
 		}
 		print "---\n\n";
 	}
-- 
1.5.4.rc5.1.g0d200

  reply	other threads:[~2008-01-29 12:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-29  2:14 [PATCH] gitweb: convert from perl internal to utf8 for commitdiff_plain Yasushi SHOJI
2008-01-29  3:11 ` Ismail Dönmez
2008-01-29  5:39 ` Junio C Hamano
2008-01-29  5:45   ` Yasushi SHOJI
2008-01-29  5:52     ` Junio C Hamano
2008-01-29 12:16       ` Yasushi SHOJI [this message]
2008-01-29 12:40         ` Jakub Narebski
2008-01-30  5:10         ` Junio C Hamano
2008-01-29 11:09 ` Jakub Narebski

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ejc0j08t.wl@mail2.atmark-techno.com \
    --to=yashi@atmark-techno.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
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 NNTP newsgroup(s).