git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Torsten Bögershausen" <tboegi@web.de>
To: Thomas Guyot <tguyot@gmail.com>
Cc: Johannes Sixt <j6t@kdbg.org>,
	CH <ch-and-git.vger.kernel.org@ch.pkts.ca>,
	git@vger.kernel.org
Subject: Re: Feature request: better error messages when UTF-8 bites
Date: Thu, 28 Jul 2022 20:01:28 +0200	[thread overview]
Message-ID: <20220728180128.dlhhu7wlbubvnyph@tb-raspi4> (raw)
In-Reply-To: <1e454493-ca57-ca2e-7d82-7333a769817e@gmail.com>

[]

>
> BTW you actually raise another issue - I do think for file paths git could
> either recompose (NFC) or decompose (NFD) the strings on storage and
> comparison (which should probably be an option... the current default for
> 2.30.2 is to treat them and print them as binary (escaped on print).
> Consider the following when using core.quotePath=false:
>
> $ touch "nfc_$(printf '\xf4')"

This is not valid unicode, isn't it ?
Probably we need to use the octal version, since not all
printf() implementation support hex values starting with 0x,
but all of them support octal:

auml=$(printf '\303\244')
aumlcdiar=$(printf '\141\314\210')


> $ touch "nfd_$(printf '\x6f\xcc\x82')"
> $ git add nf[cd]*
> $ git status
> On branch test
> Changes to be committed:
>   (use "git restore --staged <file>..." to unstage)
>     new file:   nfc_ô
>     new file:   nfd_ô

>
> I'm not sure how the Unicode will be translated here, it might depend on the
> mail client if they even's get sent as-is, but both shows the exact same
> file name, one in NFD and one in NFC format.

Translated by "whom" ?
Most programs do no translate anything here.
>
> Both are canonically equivalent and reversible. It appears MacOS already
> decompose (NFD?) filenames by default and git provides an option to
> recompose the characters (core.precomposeUnicode) which, according to the
> manual, is not even usable on Linux...

Yes. Technically you can have both under Linux, at least unless you
are running ZFS, which may be created unicode-aware (or not, that is the default).

But why do you want to have 2 files on disk with different normalizations ?


>
> More on Unicode normalization: https://unicode.org/reports/tr15/
>
> --
> Thomas

      reply	other threads:[~2022-07-28 18:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-27 20:21 Feature request: better error messages when UTF-8 bites CH
2022-07-28  5:42 ` Johannes Sixt
2022-07-28  9:40   ` Thomas Guyot
2022-07-28 18:01     ` Torsten Bögershausen [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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220728180128.dlhhu7wlbubvnyph@tb-raspi4 \
    --to=tboegi@web.de \
    --cc=ch-and-git.vger.kernel.org@ch.pkts.ca \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=tguyot@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).