summaryrefslogtreecommitdiff
path: root/pod/perllocale.pod
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2016-04-12 11:21:40 -0600
committerKarl Williamson <khw@cpan.org>2016-05-24 10:26:29 -0600
commit79f120c89a6e123770f65fd49893ef0b379cd922 (patch)
treed2af18ebcc3405e8e660c3511ecdb39ca620f471 /pod/perllocale.pod
parentc664130fefeaef47ddc7dcbf7ec1830d04af8ea7 (diff)
downloadperl-79f120c89a6e123770f65fd49893ef0b379cd922.tar.gz
Change calculation of locale collation coefficients
Every time a new collation locale is set, two coefficients are calculated that are used in predicting how much space is needed in the transformation of a string by strxfrm(). The transformed string is roughly linear with the the length of the input string, so we are calcaulating 'm' and 'b' such that transformed_length = m * input_length + b Space is allocated based on this prediction. If it is too small, the strxfrm() will fail, and we will have to increase the allotted amount and try again. It's better to get the prediction right to avoid multiple, expensive strxfrm() calls. Prior to this commit, the calculation was not rigorous, and failed on some platforms that don't have a fully conforming strxfrm(). This commit changes to not panic if a locale has an apparent defective collation, but instead silently change to use C-locale collation. It could be argued that a warning should additionally be raised. This commit fixes [perl #121734].
Diffstat (limited to 'pod/perllocale.pod')
-rw-r--r--pod/perllocale.pod3
1 files changed, 3 insertions, 0 deletions
diff --git a/pod/perllocale.pod b/pod/perllocale.pod
index d842a0781a..ddb60f2280 100644
--- a/pod/perllocale.pod
+++ b/pod/perllocale.pod
@@ -820,6 +820,9 @@ that a UTF-8 locale likely will just give you machine-native ordering.
Use L<Unicode::Collate> for the full implementation of the Unicode
Collation Algorithm.
+If Perl detects that there are problems with the locale collation order,
+it reverts to using non-locale collation rules for that locale.
+
If you have a single string that you want to check for "equality in
locale" against several others, you might think you could gain a little
efficiency by using C<POSIX::strxfrm()> in conjunction with C<eq>: