From 165a1c52807daa7ad3ecc83f0811047937088904 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Mon, 16 May 2016 15:19:14 -0600 Subject: [PATCH] Keep track of if collation locale is UTF-8 or not This will be used in future commits --- embedvar.h | 1 + intrpvar.h | 1 + locale.c | 3 +++ sv.c | 1 + 4 files changed, 6 insertions(+) diff --git a/embedvar.h b/embedvar.h index 7e551be..bd15193 100644 --- a/embedvar.h +++ b/embedvar.h @@ -168,6 +168,7 @@ #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) diff --git a/intrpvar.h b/intrpvar.h index 50a9ee0..9366383 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -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 diff --git a/locale.c b/locale.c index 918c1d9..01fca15 100644 --- 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 --- 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; -- 1.8.3.1