Re: [RFC] Support UTF-8 characters in Git alias names
- From
D. Ben Knoble <ben.knoble@gmail.com>
- Date
- Feb 8, 2026, 16:07 UTC
- Message-ID
- <CALnO6CCDazixno6Of8ufEV9=EYcGFdawmv5X2J9TNerW6CZMJw@mail.gmail.com>
- In-Reply-To
- <3124b359-2929-4f3f-9ac6-793277fe422b@jontes.page>
On Sun, Feb 8, 2026 at 10:37 AM Jonatan Holmgren <jonatan@jontes.page> wrote:
Show 27 quoted lines
>
> Hi Git developers,
>
> I'd like to propose adding support for UTF-8 characters in Git alias
> names to better support non-English speaking users as these are
> currently restricted to [a-zA-Z0-9-] which prevents users from creating
> aliases in languages with other characters. Shell aliases do not solve
> this as the best you could do is "git-förgrena".
>
>
> This would allow users to set aliases such as:
>
> git config alias.förgrena branch # Swedish
> git config alias.分支 branch # Chinese
>
> etc.
>
> The restriction comes from iskeychar() in config.c:526-529:
>
> static inline int iskeychar(int c)
> {
> return isalnum(c) || c == '-';
> }
>
> The function in question validates all Git config keys, not just
> aliases. The git_config_parse_key() function (same file, 543-598)
> enforces this validation and uses tolower(), which only works for ASCII.In particular, this comes from sane-ctype.h and ctype.c, which I could not easily rip out of the build :/
It looks like Git's ctype definitions are ASCII-specific even though isalnum(3) on my system is documented as using the locale, so I was hoping that if I could build Git without it's own ctype.c I could test your aliases. Bummer.
It looks like this goes back to 4546738b58 (Unlocalized isspace and friends, 2005-10-13). I don't have an amlog note for it, but searching all of lore turned up <https://lore.kernel.org/all/Pine.LNX.4.64.0510130838240.15297@g5.osdl.org/>. In the same thread, [1] suggests we'd have to use more complex logic to parse UTF-8 config, right?
[1]: https://lore.kernel.org/all/434E8650.7060604@zytor.com/
Anyway, my opinion (not that it holds much weight) is that user-facing parts of Git ought to support international languages. (If the `diff` line for git-apply(1) has to be ASCII, that's probably fine [2]; it should definitely be parsed as a byte-stream.)
[2]: https://lore.kernel.org/all/7vachd6hdx.fsf@assigned-by-dhcp.cox.net/
-- D. Ben Knoble