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

Re: 'git diff' command doesn't honor utf8 symbol boundaries, and doesn't use actual terminal width

From
Duy Nguyen <pclouds@gmail.com>
Date
Jan 25, 2014, 04:02 UTC
Message-ID
<CACsJy8Cgz+18F85408vKL-pBHPOLjxJjsbTF+pL4D2k=DbU0-g@mail.gmail.com>
In-Reply-To
<52E330CC.10400@rawbw.com>
On Sat, Jan 25, 2014 at 10:34 AM, Yuri <yuri@rawbw.com> wrote:
Show 20 quoted lines
> The fragment of 'git diff' output looks like this:
> - <translation>Ошибка: адрес %1 содержит запрещенные символы. Пожалуйста,
> перепро�
> + <translation>Ошибка: адрес %1 содержит запрещённые символы. Пожалуйста,
> перепро�
>
> Two issues here:
> 1. Cyrilic text in utf8 got truncated not at utf8 boundary, causing this
> garbage symbol in the end
> 2. Truncation is done at somewhat ~70% of the actual screen width. git could
> go all the way to the whole screen with, but it didn't. Shrinking terminal
> width causes the output truncation limit to shrink in the same proportion.
> So some bad decision about truncation size is made somewhere in 'git diff'
> command.
>
> Suggested behavior:
> 1. git should respect utf8, and in case of truncation it should add …
> symbol.
> 2. truncation algorithm should read current terminal width and truncate at
> width-1 length to allow for the above-mentioned symbol

I don't think git diff truncates its output (it does truncate @@ lines, but not the real diff). Perhaps your pager did that?

-- 
Duy
Previous: Yuri
Message 2 of 2 in “'git diff' command doesn't honor utf8 symbol boundaries, and doesn't use actual terminal width”
  1. YuriJan 25, 2014
  2. Duy NguyenJan 25, 2014

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.