git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, Jonathan Niedier <jrnieder@gmail.com>,
	"Shawn O. Pearce" <spearce@spearce.org>,
	Scott Chacon <schacon@gmail.com>
Subject: Re: [PATCH/RFC v2] Document format of basic Git objects
Date: Mon, 20 Feb 2012 11:11:01 -0500	[thread overview]
Message-ID: <20120220161101.GA27105@sigill.intra.peff.net> (raw)
In-Reply-To: <CACsJy8CEeZPf55idLB9NE-rf--ySmZh_9gkMc_zo0VmiVftMUg@mail.gmail.com>

On Mon, Feb 20, 2012 at 08:55:28PM +0700, Nguyen Thai Ngoc Duy wrote:

> > Author-ident is typically utf-8 already, so you cannot assume "ASCII".
> 
> I wonder if anyone puts non utf-8 strings in there, or could we
> enforce utf-8 (i.e. validate and reject non utf-8 strings) and accept
> encoded word syntax (rfc 2047) with the help of the new
> $GIT_IDENT_ENCODING variable. The "accept ..." part can wait until
> someone is hit by "utf-8 only" check and steps up.

I was just having a similar discussion with libgit2 folks, who were
wondering if there would ever be non-utf8 in there. When we call
"reencode_commit_message", it looks like we do the whole object. In
other words, your author name _must_ match any encoding you specify in
the "encoding" header.

I.e., if you do:

  # latin1 é
  e=`printf '\xe9'`

  export GIT_AUTHOR_NAME="P${e}ff King"
  git init
  git config i18n.commitencoding iso8859-1
  touch foo && git add foo &&
  git commit --allow-empty -m "more latin1 ${e}ncoding"

both the name and the message should show fine on your utf8 terminal if
you do this:

  git config i18n.logoutputencoding utf8
  git show

And similarly, we do the right thing in format-patch, both with and
without logoutputencoding set:

  $ git format-patch --root --stdout | grep -Ei "^(from|subject):"
  From: =?iso8859-1?q?P=E9ff=20King?= <peff@peff.net>
  Subject: [PATCH] =?iso8859-1?q?more=20latin1=20=E9ncoding?=

  $ git config i18n.logoutputencoding utf8
  $ git format-patch --root --stdout | grep -Ei "^(from|subject):"
  From: =?utf8?q?P=C3=A9ff=20King?= <peff@peff.net>
  Subject: [PATCH] =?utf8?q?more=20latin1=20=C3=A9ncoding?=

(where 0xc3a9 is the utf8 equivalent of latin1 0xe9).

So I have no idea if people are using it or not, but it is actually
usable.

-Peff

  reply	other threads:[~2012-02-20 16:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-15 13:22 [PATCH/RFC] Document format of basic Git objects Nguyễn Thái Ngọc Duy
2012-02-15 17:31 ` Jonathan Nieder
2012-02-15 19:48 ` Junio C Hamano
2012-02-16  7:12   ` Junio C Hamano
2012-02-19  4:15 ` [PATCH/RFC v2] " Nguyễn Thái Ngọc Duy
2012-02-19  8:39   ` Junio C Hamano
2012-02-19  9:14     ` Junio C Hamano
2012-02-20 13:55     ` Nguyen Thai Ngoc Duy
2012-02-20 16:11       ` Jeff King [this message]
2012-02-19 18:07   ` Manually decoding a git object Philip Oakley
2012-02-20  4:45     ` 徐迪
2012-02-20  8:19       ` Philip Oakley
2012-02-20  8:29     ` Thomas Rast
2012-02-20 10:19       ` Philip Oakley
2012-02-20 10:56         ` Thomas Rast
2012-02-20 11:39           ` 徐迪
2012-02-20 18:27           ` Philip Oakley

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=20120220161101.GA27105@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=schacon@gmail.com \
    --cc=spearce@spearce.org \
    /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).