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

Re: [BUG REPORT] File names that contain UTF8 characters are unnecessarily escaped in 'git status .' messages

From
Thomas Guyot <tguyot@gmail.com>
Date
May 31, 2021, 01:14 UTC
Message-ID
<c1afaf46-0425-110b-6303-f68d3f994b7f@gmail.com>
In-Reply-To
<481fbc88-3e7d-6b00-0997-1a80b87a637d@rawbw.com>
On 2021-05-30 17:55, Yuri wrote:
Show 14 quoted lines
> On 5/30/21 2:44 PM, Jeff King wrote:
>> Yeah, I'm not sure how such a check would be done. On most Linux systems
>> I've seen, $LANG will mention "en_US.UTF-8" or similar. But I've no idea
>> how portable that convention is, not to mention that people may have
>> more complex setups anyway (e.g., not setting $LANG but setting some of
>> LC_*).
> 
> 
> When 'locale charmap' prints 'UTF-8' the terminal can be assumed to be
> able to accept UTF-8 characters.
> 
> 'locale charmap', I think, determines this only based on environment
> variables.
> 
Hi Yuri,

Even if the terminal supports UTF8, will it print it properly? The font used could have no or minimal utf8 support. Even when it's supported, some characters might look alike and this could have undesired consequences (ex accidentally switching from a normal space to a non-break space while renaming a file that has spaces...).

I believe repos with utf8 files are rare enough and it could be left to the user to select whenever to use utf8 or not... An option like "auto" or "detect" could make it automatic but I'm not convinced it should be the default.

Oh, and looking at "locale charmap", it doesn't check the terminal capabilities at all - it just prints the charmap based on LC_ALL or LC_CTYPE value, or default if they're unset. It doesn't mater what terminal you're on...

Regards,

-- Thomas

Previous: YuriNext: Bagas Sanjaya
Message 12 of 14 in “[BUG REPORT] File names that contain UTF8 characters are unnecessarily escaped in 'git status .' messages”
  1. YuriMay 26, 2021
  2. Junio C HamanoMay 26, 2021
  3. YuriMay 26, 2021
  4. Torsten BögershausenMay 27, 2021
  5. Jeff KingMay 27, 2021
  6. YuriMay 27, 2021
  7. Bagas SanjayaMay 28, 2021
  8. YuriMay 28, 2021
  9. Torsten BögershausenMay 29, 2021
  10. Jeff KingMay 30, 2021
  11. YuriMay 30, 2021
  12. Thomas GuyotMay 31, 2021
  13. Bagas SanjayaMay 31, 2021
  14. Junio C HamanoMay 30, 2021

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.