This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
locale.c: Use computed length for U+10FFFF
authorKarl Williamson <khw@cpan.org>
Sat, 18 Nov 2017 23:50:48 +0000 (16:50 -0700)
committerKarl Williamson <khw@cpan.org>
Sun, 19 Nov 2017 02:49:47 +0000 (19:49 -0700)
The previous commit calculates this and placed the result in a header
file.  This now uses the calculated value instead of a hard-coded "4",
which is incorrect on EBCDIC platforms.

locale.c

index bc507d9..79ecaa3 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -2939,7 +2939,7 @@ Perl__is_cur_LC_category_utf8(pTHX_ int category)
          * Unicode code point.  Since UTF-8 is the only non-single byte
          * encoding we handle, we just say any such encoding is UTF-8, and if
          * turns out to be wrong, other things will fail */
-        is_utf8 = MB_CUR_MAX >= 4;
+        is_utf8 = MB_CUR_MAX >= STRLENs(MAX_UNICODE_UTF8);
 
         DEBUG_L(PerlIO_printf(Perl_debug_log,
                               "\tMB_CUR_MAX=%d; ?UTF8 locale=%d\n",