Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] Win32: PCRE2 Unicode support with MSVC

Maxim Dounin
March 20, 2023 07:56PM
Hello!

On Mon, Mar 20, 2023 at 06:58:32PM +0400, Sergey Kandaurov wrote:

> # HG changeset patch
> # User Sergey Kandaurov <pluknet@nginx.com>
> # Date 1679324252 -14400
> # Mon Mar 20 18:57:32 2023 +0400
> # Node ID d0b013a7050e00613804b399ae2ca74551b2a071
> # Parent 8771d35d55d0a2b1cefaab04401d6f837f5a05a2
> Win32: PCRE2 Unicode support with MSVC.
>
> Unicode support in PCRE2 is enabled by default on configure/cmake side
> by defining SUPPORT_UNICODE. Previously, this macro was not defined
> when compiling directly PCRE2 sources for Windows with MSVC.
>
> In particular, this change allows to specify Unicode properties, such as
> \P, \p, or \X, as caught by http_server_name.t adjusted to run on Windows:
>
> nginx: [emerg] pcre2_compile() failed: this version of PCRE2 does not have
> support for \P, \p, or \X
>
> diff --git a/auto/lib/pcre/make b/auto/lib/pcre/make
> --- a/auto/lib/pcre/make
> +++ b/auto/lib/pcre/make
> @@ -61,7 +61,7 @@ if [ $PCRE_LIBRARY = PCRE2 ]; then
>
> PCRE_CFLAGS = -O2 -Ob1 -Oi -Gs $LIBC $CPU_OPT
> PCRE_FLAGS = -DHAVE_CONFIG_H -DPCRE2_STATIC -DPCRE2_CODE_UNIT_WIDTH=8 \\
> - -DHAVE_MEMMOVE
> + -DHAVE_MEMMOVE -DSUPPORT_UNICODE
>
> PCRE_SRCS = $ngx_pcre_srcs
> PCRE_OBJS = $ngx_pcre_objs

The PCRE2 compilation in auto/lib/pcre/make mostly matches PCRE
compilation in auto/lib/pcre/makefile.msvc, and it never tried to
enable Unicode / UTF-8 support. This in turn matches PCRE
configure behaviour: UTF-8 support is disabled by default and
needs to be explicitly enabled.

While we might consider enabling Unicode support for PCRE2, since
it is now enabled by default in PCRE2 (or for both PCRE and PCRE2,
since it is something usually expected to work nowadays), for
tests a better solution might be to don't rely on this. Unicode /
UTF-8 support might not be available on various other platforms as
well, so it's generally might be a good idea to adjust tests to
tolerate PCRE/PCRE2 compiled without Unicode / UTF-8 support.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Win32: PCRE2 Unicode support with MSVC

Sergey Kandaurov 458 March 20, 2023 11:00AM

Re: [PATCH] Win32: PCRE2 Unicode support with MSVC

Maxim Dounin 137 March 20, 2023 07:56PM

Re: [PATCH] Win32: PCRE2 Unicode support with MSVC

Sergey Kandaurov 138 March 21, 2023 05:52AM

Re: [PATCH] Win32: PCRE2 Unicode support with MSVC

Maxim Dounin 161 March 21, 2023 03:50PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 319
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready