diff options
Diffstat (limited to 'src/pcresearch.c')
-rw-r--r-- | src/pcresearch.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/pcresearch.c b/src/pcresearch.c index a8034fbc..5b111bea 100644 --- a/src/pcresearch.c +++ b/src/pcresearch.c @@ -145,10 +145,12 @@ Pcompile (char *pattern, idx_t size, reg_syntax_t ignored, bool exact) = pcre2_general_context_create (private_malloc, private_free, NULL); pcre2_compile_context *ccontext = pcre2_compile_context_create (gcontext); - uint32_t unicode = 1; - pcre2_config (PCRE2_CONFIG_UNICODE, &unicode); - if (unicode && localeinfo.multibyte) + if (localeinfo.multibyte) { + uint32_t unicode; + if (pcre2_config (PCRE2_CONFIG_UNICODE, &unicode) < 0 || !unicode) + die (EXIT_TROUBLE, 0, + _("-P supports only unibyte locales on this platform")); if (! localeinfo.using_utf8) die (EXIT_TROUBLE, 0, _("-P supports only unibyte and UTF-8 locales")); flags |= (PCRE2_UTF | PCRE2_UCP); |