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

Re: Consider escaping special characters like 'less' does

From
Andreas Schwab <schwab@linux-m68k.org>
Date
Oct 15, 2017, 15:46 UTC
Message-ID
<87zi8sxvkg.fsf@linux-m68k.org>
In-Reply-To
<773EDE3B5FDB48AD8FB0DB048CAEC8DE@blackfat>
On Okt 15 2017, "Jason Pyeron" <jpyeron@pdinc.us> wrote:
Show 33 quoted lines
>> -----Original Message-----
>> From: Joris Valette
>> Sent: Sunday, October 15, 2017 9:34 AM
>> To: git@vger.kernel.org
>> Subject: Consider escaping special characters like 'less' does
>> 
>> The pager 'less' escapes some characters when calling 'git diff'. This
>> is what I might get:
>> 
>> $ git diff --cached
>> diff --git a/some_file b/some_file
>> new file mode 100644
>> index 0000000..357323f
>> --- /dev/null
>> +++ b/some_file
>> @@ -0,0 +1 @@
>> +<U+FEFF>Hello
>> \ No newline at end of file
>> 
>> This example is a simple file encoded in UTF-8 *with BOM*.
>> On the other hand, the built-in git output shows this:
>> 
>> $ git --no-pager diff --cached
>> diff --git a/some_file b/some_file
>> new file mode 100644
>> index 0000000..357323f
>> --- /dev/null
>> +++ b/some_file
>> @@ -0,0 +1 @@
>> +?Hello
>> \ No newline at end of file
>
> It is your terminal, not git's fault that you get a ? rendered.
It's your MUA's fault that you get a ?, the mail didn't contain any.
Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Previous: Jason PyeronNext: Joris Valette
Message 3 of 13 in “Consider escaping special characters like 'less' does”
  1. Joris ValetteOct 15, 2017
  2. Jason PyeronOct 15, 2017
  3. Andreas SchwabOct 15, 2017
  4. Joris ValetteOct 15, 2017
  5. Jeff KingOct 15, 2017
  6. Joris ValetteOct 15, 2017
  7. Jeff KingOct 16, 2017
  8. Andreas SchwabOct 16, 2017
  9. Jeff KingOct 16, 2017
  10. Junio C HamanoOct 17, 2017
  11. Jeff KingOct 17, 2017
  12. Jason PyeronOct 22, 2017
  13. Jeff KingOct 23, 2017

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.