diff options
author | Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> | 2022-09-26 10:52:50 +0900 |
---|---|---|
committer | Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> | 2022-09-26 10:52:50 +0900 |
commit | 1b421e4978440234fb73117c8505dad1ccc68d46 (patch) | |
tree | 190373cda6247f5466850478f6ca5d42d3bbc73e /Src/Modules/pcre.c | |
parent | 6e827d8f9a50653aa1905d8aff8cc91e6e2423c4 (diff) | |
download | zsh-1b421e4978440234fb73117c8505dad1ccc68d46.tar.gz zsh-1b421e4978440234fb73117c8505dad1ccc68d46.tar.xz zsh-1b421e4978440234fb73117c8505dad1ccc68d46.zip |
50658 + test: Enable to switch between C/UTF-8 locales in PCRE
Diffstat (limited to 'Src/Modules/pcre.c')
-rw-r--r-- | Src/Modules/pcre.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Src/Modules/pcre.c b/Src/Modules/pcre.c index 6289e003e..46875a59b 100644 --- a/Src/Modules/pcre.c +++ b/Src/Modules/pcre.c @@ -47,8 +47,6 @@ zpcre_utf8_enabled(void) #if defined(MULTIBYTE_SUPPORT) && defined(HAVE_NL_LANGINFO) && defined(CODESET) static int have_utf8_pcre = -1; - /* value can toggle based on MULTIBYTE, so don't - * be too eager with caching */ if (have_utf8_pcre < -1) return 0; @@ -56,15 +54,11 @@ zpcre_utf8_enabled(void) return 0; if ((have_utf8_pcre == -1) && - (!strcmp(nl_langinfo(CODESET), "UTF-8"))) { - - if (pcre_config(PCRE_CONFIG_UTF8, &have_utf8_pcre)) + (pcre_config(PCRE_CONFIG_UTF8, &have_utf8_pcre))) { have_utf8_pcre = -2; /* erk, failed to ask */ } - if (have_utf8_pcre < 0) - return 0; - return have_utf8_pcre; + return (have_utf8_pcre == 1) && (!strcmp(nl_langinfo(CODESET), "UTF-8")); #else return 0; |