This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Keep track of if collation locale is UTF-8 or not
authorKarl Williamson <khw@cpan.org>
Mon, 16 May 2016 21:19:14 +0000 (15:19 -0600)
committerKarl Williamson <khw@cpan.org>
Tue, 24 May 2016 16:26:28 +0000 (10:26 -0600)
This will be used in future commits

embedvar.h
intrpvar.h
locale.c
sv.c

index 7e551be..bd15193 100644 (file)
 #define PL_in_clean_objs       (vTHX->Iin_clean_objs)
 #define PL_in_eval             (vTHX->Iin_eval)
 #define PL_in_load_module      (vTHX->Iin_load_module)
+#define PL_in_utf8_COLLATE_locale      (vTHX->Iin_utf8_COLLATE_locale)
 #define PL_in_utf8_CTYPE_locale        (vTHX->Iin_utf8_CTYPE_locale)
 #define PL_incgv               (vTHX->Iincgv)
 #define PL_initav              (vTHX->Iinitav)
index 50a9ee0..9366383 100644 (file)
@@ -245,6 +245,7 @@ PERLVAR(I, exit_flags,      U8)             /* was exit() unexpected, etc. */
 
 PERLVAR(I, utf8locale, bool)           /* utf8 locale detected */
 PERLVAR(I, in_utf8_CTYPE_locale, bool)
+PERLVAR(I, in_utf8_COLLATE_locale, bool)
 #ifdef USE_LOCALE_CTYPE
     PERLVAR(I, warn_locale, SV *)
 #endif
index 918c1d9..01fca15 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -485,6 +485,7 @@ Perl_new_collate(pTHX_ const char *newcoll)
       is_standard_collation:
        PL_collxfrm_base = 0;
        PL_collxfrm_mult = 2;
+        PL_in_utf8_COLLATE_locale = FALSE;
        return;
     }
 
@@ -498,6 +499,8 @@ Perl_new_collate(pTHX_ const char *newcoll)
             goto is_standard_collation;
         }
 
+        PL_in_utf8_COLLATE_locale = _is_cur_LC_category_utf8(LC_COLLATE);
+
        {
             /* A locale collation definition includes primary, secondary,
              * tertiary, etc. weights for each character.  To sort, the primary
diff --git a/sv.c b/sv.c
index b7c5fae..e2288b5 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -14789,6 +14789,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
     /* Did the locale setup indicate UTF-8? */
     PL_utf8locale      = proto_perl->Iutf8locale;
     PL_in_utf8_CTYPE_locale = proto_perl->Iin_utf8_CTYPE_locale;
+    PL_in_utf8_COLLATE_locale = proto_perl->Iin_utf8_COLLATE_locale;
     /* Unicode features (see perlrun/-C) */
     PL_unicode         = proto_perl->Iunicode;