git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alexander Gavrilov" <angavrilov@gmail.com>
To: "Johannes Schindelin" <Johannes.Schindelin@gmx.de>
Cc: "Constantine Plotnikov" <constantine.plotnikov@gmail.com>,
	git@vger.kernel.org
Subject: Re: Bug: UTF-16, UCS-4 and non-existing encodings for git log result in incorrect behavior
Date: Wed, 12 Nov 2008 19:58:11 +0300	[thread overview]
Message-ID: <bb6f213e0811120858lbcefa25v47a4fb14d8537839@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.1.00.0811121740120.30769@pacific.mpi-cbg.de>

On Wed, Nov 12, 2008 at 7:42 PM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> On Wed, 12 Nov 2008, Alexander Gavrilov wrote:
>> On Wed, Nov 12, 2008 at 7:15 PM, Johannes Schindelin
>> <Johannes.Schindelin@gmx.de> wrote:
>> > On Wed, 12 Nov 2008, Constantine Plotnikov wrote:
>> >> Commit encoding is set correctly. The problem is that git log and git
>> >> show do not support the *output* encodings UTF-16 and UCS-4 and
>> >> silently fail in that case instead of reporting the error.
>> >
>> > That looks more like an iconv bug to me.  I assume you are using Windows?
>>
>> Iconv has no way to know that git cannot work with ASCII-incompatible
>> encodings, and UTF-16 is incompatible, because it fills the output with
>> loads of zero bytes. Git both truncates messages on these bytes, and
>> forgets inserting them in strings that it produces itself.
>
> Ah, I thought that the issue was that Git would not handle commits in that
> encoding correctly.  Instead, it appears that Git cannot work with UTF-16
> _displays_.

Actually, I think that using those encodings in commits is asking for
trouble too, because the encoding conversion is, as far as I remember,
applied to the entire contents of the commit object, and Git,
naturally, doesn't insert any null bytes in the commit headers to
please the decoder. The result is a completely trashed object on
output.

Also, I think that they are generally a poor choice of an encoding for
data transmission, because they are ASCII-incompatible,
stdlib-incompatible, unreliable to loss and addition of single bytes,
and have no way to detect encoding mismatch except by metadata or
heuristics: almost any string of shorts is "valid".

Alexander

      reply	other threads:[~2008-11-12 16:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-12 13:32 Bug: UTF-16, UCS-4 and non-existing encodings for git log result in incorrect behavior Constantine Plotnikov
2008-11-12 14:22 ` Johannes Schindelin
     [not found]   ` <85647ef50811120727j730cb6e3lf4103c200d042fb9@mail.gmail.com>
2008-11-12 16:15     ` Johannes Schindelin
2008-11-12 16:17       ` Alexander Gavrilov
2008-11-12 16:42         ` Johannes Schindelin
2008-11-12 16:58           ` Alexander Gavrilov [this message]

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=bb6f213e0811120858lbcefa25v47a4fb14d8537839@mail.gmail.com \
    --to=angavrilov@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=constantine.plotnikov@gmail.com \
    --cc=git@vger.kernel.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).