git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug: UTF-16, UCS-4 and non-existing encodings for git log result in incorrect behavior

From
Alexander Gavrilov <angavrilov@gmail.com>
Date
Nov 12, 2008, 16:17 UTC
Message-ID
<bb6f213e0811120817i20d5c0ajf0c9e289c11387a6@mail.gmail.com>
In-Reply-To
<alpine.DEB.1.00.0811121714280.30769@pacific.mpi-cbg.de>

On Wed, Nov 12, 2008 at 7:15 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

Show 30 quoted lines
> Hi,
>
> [re Cc:ing the list]
>
> On Wed, 12 Nov 2008, Constantine Plotnikov wrote:
>
>> On Wed, Nov 12, 2008 at 5:22 PM, Johannes Schindelin
>> <Johannes.Schindelin@gmx.de> wrote:
>> >
>> > On Wed, 12 Nov 2008, Constantine Plotnikov wrote:
>> >
>> >> If UTF-16[BE|LE] or UCS-4[BE|LE] encodings are used with git log, the
>> >> git completes successfully but commit messages and author information
>> >> are not shown. I suggest that git should fail with fatal error if such
>> >> zero producing encoding is used.
>> >>
>> >> If the incorrect encoding name is used, the git log does not perform any
>> >> re-encoding, but just display commits in their native encoding. I
>> >> suggest that git should fail with fatal error in this case as well.
>> >
>> > Have you set the correct encoding with i18n.commitEncoding?  If not, you
>> > should not be surprised: Git's default encoding is UTF-8, and that fact is
>> > well documented, AFAICT.
>> >
>> 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.

A separate problem is that it allows creating commits with invalid encoding names, which may be unnoticed for a long time in an environment with uniform commitencoding settings.

Alexander
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 4 of 6 in “Bug: UTF-16, UCS-4 and non-existing encodings for git log result in incorrect behavior”
  1. Constantine PlotnikovNov 12, 2008
  2. Johannes SchindelinNov 12, 2008
  3. Johannes SchindelinNov 12, 2008
  4. Alexander GavrilovNov 12, 2008
  5. Johannes SchindelinNov 12, 2008
  6. Alexander GavrilovNov 12, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.