From 24b4c3036718873ce304c8bf491d5643364fa897 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 2 Oct 2019 15:29:05 -0600 Subject: [PATCH] Allow core to work with code points above IV_MAX Higher has been reserved for core use, and a future commit will want to finally do this. --- utf8.c | 4 +++- utf8.h | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/utf8.c b/utf8.c index 9112145..6b98473 100644 --- a/utf8.c +++ b/utf8.c @@ -324,7 +324,9 @@ Perl_uvoffuni_to_utf8_flags_msgs(pTHX_ U8 *d, UV uv, const UV flags, HV** msgs) * performance hit on these high EBCDIC code points. */ if (UNLIKELY(UNICODE_IS_SUPER(uv))) { - if (UNLIKELY(uv > MAX_LEGAL_CP)) { + if (UNLIKELY( uv > MAX_LEGAL_CP + && ! (flags & UNICODE_ALLOW_ABOVE_IV_MAX))) + { Perl_croak(aTHX_ cp_above_legal_max, uv, MAX_LEGAL_CP); } if ( (flags & UNICODE_WARN_SUPER) diff --git a/utf8.h b/utf8.h index 7ef1102..6a11ce0 100644 --- a/utf8.h +++ b/utf8.h @@ -940,6 +940,10 @@ Evaluates to 0xFFFD, the code point of the Unicode REPLACEMENT CHARACTER #define UNICODE_DISALLOW_NONCHAR 0x0020 #define UNICODE_DISALLOW_SUPER 0x0040 #define UNICODE_DISALLOW_PERL_EXTENDED 0x0080 + +#ifdef PERL_CORE +# define UNICODE_ALLOW_ABOVE_IV_MAX 0x0100 +#endif #define UNICODE_DISALLOW_ABOVE_31_BIT UNICODE_DISALLOW_PERL_EXTENDED #define UNICODE_GOT_SURROGATE UNICODE_DISALLOW_SURROGATE -- 1.8.3.1