This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix multi-char fold edge case
authorKarl Williamson <public@khwilliamson.com>
Sat, 18 May 2013 14:25:16 +0000 (08:25 -0600)
committerKarl Williamson <public@khwilliamson.com>
Mon, 20 May 2013 17:01:52 +0000 (11:01 -0600)
commit1ca267a56acf698557ec1deec44af651acc88696
tree007f9d40b63b92728a095d5defdad663e239289c
parent519101418837cf0edacb710b2b38b42dad6e47c1
Fix multi-char fold edge case

use locale;
fc("\N{LATIN CAPITAL LETTER SHARP S}")
   eq 2 x fc("\N{LATIN SMALL LETTER LONG S}")

should return true, as the SHARP S folds to two 's's in a row, and the
LONG S is an antique variant of 's', and folds to s.  Until this commit,
the expression was false.

Similarly, the following should match, but didn't until this commit:

"\N{LATIN SMALL LETTER SHARP S}" =~ /\N{LATIN SMALL LETTER LONG S}{2}/iaa

The reason these didn't work properly is that in both cases the actual
fold to 's' is disallowed.  In the first case because of locale; and in
the second because of /aa.  And the code wasn't smart enough to realize
that these were legal.

The fix is to special case these so that the fold of sharp s (both
capital and small) is two LONG S's under /aa; as is the fold of the
capital sharp s under locale.  The latter is user-visible, and the
documentation of fc() now points that out.  I believe this is such an
edge case that no mention of it need be done in perldelta.
lib/locale.t
pod/perlfunc.pod
regcharclass.h
regcomp.c
regen/regcharclass_multi_char_folds.pl
t/uni/fold.t
utf8.c