git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Jiang Xin <worldhello.net@gmail.com>
Cc: "Johannes Sixt" <j.sixt@viscovery.net>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Git List" <git@vger.kernel.org>,
	"Ævar Arnfjörð" <avarab@gmail.com>
Subject: Re: [PATCH] Update l10n guide
Date: Fri, 02 Mar 2012 06:56:12 -0800 (PST)	[thread overview]
Message-ID: <m362enuk53.fsf@localhost.localdomain> (raw)
In-Reply-To: <CANYiYbG-Gp0cELF7_CxT1veRod+ookBaucfjCpWZjK1kTC0sAQ@mail.gmail.com>

Jiang Xin <worldhello.net@gmail.com> writes:
> 2012/3/2 Johannes Sixt <j.sixt@viscovery.net>:

> > It does not convert, but it records which encoding the text has. If you
> > don't specify anything, UTF-8 is assumed, and if your text is actually not
> > UTF-8, the result is necessarily garbage.
> >
> > Then you haven't set i18n.commitEncoding. Try this:
> >
> >   git config i18n.commitEncoding CP936
> 
> I know there are two config variables. i18n.commitEncoding will insert
> a "encoding XX" line to the commit object, while i18n.logOutputEncoding
> will set the default output encoding.

Note that according to documentation 'git commit' issues a warning if
the commit log message given to it does not look like a valid UTF-8
string, unless you explicitly say your project uses a legacy encoding.
Modern git would also warn if you have NUL ("\0") character in your
commit message, e.g. when using UCS-2 / UTF-16 encoding.

> But this implementation seems like a workaround.
> 
> * Tree objects do not have such implementation, so multibyte characters
>   can not be used as filenames.

And there is no place on pathnameEncoding in 'tree' object,
unfortunately.

One proposed solution was to convert filenames from filesystem
encoding to normal-form composed UTF-8 when creating tree objects, but
this would have to be optional.

Anyway at least for source code using characters outside US-ASCII is
really discouraged anyway.  Note also that sample 'pre-commit' hook
prevents adding files with non-ascii filenames.
 
> * Commit object without "encoding" instruction will be used as it is. So
>   people under the same non-utf8 locale may not notice that they
>   have not set the proper i18n.commitEncoding, until one day they
>   need accross platform development.

But see above.
 
> * As raw commit log alway used as fallback, sometimes it is hard to find
>   commit objects with wrong encoding instructions.
> 
> I think save commit object, tree object, packed-refs in UTF-8 is
> a better implementation.

Backward compatibiltiyt and performance.

-- 
Jakub Narebski

  reply	other threads:[~2012-03-02 14:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-28 17:40 l10n: the maintaince of git-po repo Jiang Xin
2012-02-29  5:34 ` Junio C Hamano
2012-02-29  8:23   ` [PATCH] Update l10n guide Junio C Hamano
2012-03-01  4:05     ` Jiang Xin
2012-03-01  5:25       ` Junio C Hamano
2012-03-02  7:30         ` Jiang Xin
2012-03-02 10:47           ` Johannes Sixt
2012-03-02 12:18             ` Jiang Xin
2012-03-02 14:56               ` Jakub Narebski [this message]
2012-03-02 16:59               ` Junio C Hamano
2012-03-02  7:41         ` [PATCH] Update l10n guide: change the repository URL, etc Jiang Xin

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=m362enuk53.fsf@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    --cc=worldhello.net@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.
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).