[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Letter-case conversions in network protocols
From: |
Stefan Monnier |
Subject: |
Re: Letter-case conversions in network protocols |
Date: |
Sat, 08 May 2021 09:47:56 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> The general problem that I'd like us to discuss is how to deal with
> letter-case conversions in code that deals with protocols, such as
> network-related protocols, that need to recognize certain keywords.
[...]
> Are there better solutions? Ideas are welcome.
FWIW, I think the sanest way to solve this problem is to make sure
localization doesn't affect the case-mapping of ASCII chars.
I have no idea how "unacceptable" that is for someone using a locale
such as Turkish, tho.
To do better, we could add a separate nonascii case table and those
places in the code that manipulate "text" would then have to use
(with-case-table nonascii-case-table ...)
This said, another approach is to improve our handling of case-fold: instead
of applying `downcase` on both sides and checking that it gives the same
result, we should be using a "normalization" function which will return
"the representative" of a given equivalence class. E.g. in a Turkish
locale, `i`, `I`, and `ı`, ` should all belong to the same equivalence
class and this normalization function should hence return the same value
for all three.
Stefan