[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17130: 24.4.50; Deficient Unicode case folding

From: Eli Zaretskii
Subject: bug#17130: 24.4.50; Deficient Unicode case folding
Date: Sat, 29 Mar 2014 17:45:47 +0300

> From: Nathan Trapuzzano <address@hidden>
> Cc: address@hidden
> Date: Sat, 29 Mar 2014 10:03:32 -0400
> Eli Zaretskii <address@hidden> writes:
> >> Reading through the manual section on case tables, it seems that this
> >> could be supported via the extra "canonicalize" slot:
> >> 
> >>       The canonicalize table maps all of a set of case-related
> >>       characters into a particular member of that set.
> >
> > Not efficiently, no.  E.g., how will you find ς from σ, using this
> > method?
> σ, ς, and Σ would all have σ in the CANONICALIZE slot, since they all
> fold to σ.

So you would need to search all characters to find those which have σ
in the CANONICALIZE slot -- not very efficient, to say the least.

IOW, what you suggest will provide a one-way mapping, whereas we need
a two-way mapping.

> > Besides, don't we also need to know that ς can only be present at the
> > end of a word?
> Don't think so.  AFAIK, Unicode says nothing about ordering except when
> it comes to combining characters.  But even it did prescribe such a
> rule, I don't think it would have anything to do with case folding.

Who said this is only about case folding?  Emacs should use this data
for up-casing and down-casing as well, for example, so that M-l
downcases Σ to ς, not σ, when it is at the end of the word.  Wouldn't
users of Greek expect that?

> >> If this isn't already used for Unicode case folding, what _is_ it used
> >> for?
> >
> > It is used for case-insensitive regexp matching, see search.c.
> Right, but what I'm asking is: if Emacs doesn't do Unicode case folding,
> what is the purpose of the CANONICALIZE slot except as a kind of
> placeholder that gets autofilled?

Whenever you need the canonical equivalent of a character, such as in
case-insensitive search, you need that slot.

> Are there other kinds of case folding--other than traditional
> upper/lower and Unicode--that I'm not aware of?

There's "title case", of course.  There are also characters whose case
pair is not a single character, but several, like the upper-case
variant of ß in German.  Basically, any character not marked "C" in
the Unicode CaseFolding.txt is special in some way.

> I understand that Emacs autofills the CANONICALIZE slot from
> the other slots, but only when the CANONICALIZE slot is not already set
> to non-nil.  What if the CANONICALIZE slot on ς were set to σ?  I think
> that's all that would have to happen for the Unicode folding to work.
> It seems the machinery is already in place.

For this case, maybe (and even it doesn't handle Σ correctly, I think,
when downcased at the end of the word).  For other cases, not

Personally, I think we need an additional slot for what you want, and
code to use it.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]