Skip to content

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented May 16, 2019

On some recent Windows systems, ext\pcre\tests\locales.phpt fails,
because 'pt_PT' is accepted by setlocale(), but not properly
supported by the ctype functions, which are used internally by PCRE2 to
build the localized character tables.

Since there appears to be no way to properly check whether a given
locale is fully supported, but we want to minimize BC impact, we filter
out typical Unix locale names, except for a few cases which have
already been properly supported on Windows. This way code like

setlocale(LC_ALL, 'de_DE.UTF-8', 'de_DE', 'German_Germany.1252');

should work like on older Windows systems.

It should be noted that the locale names causing trouble are not (yet)
documented as valid names anyway, see
https://docs.microsoft.com/en-us/cpp/c-runtime-library/locale-names-languages-and-country-region-strings?view=vs-2019.

On some recent Windows systems, ext\pcre\tests\locales.phpt fails,
because 'pt_PT' is accepted by `setlocale()`, but not properly
supported by the ctype functions, which are used internally by PCRE2 to
build the localized character tables.

Since there appears to be no way to properly check whether a given
locale is fully supported, but we want to minimize BC impact, we filter
out typical Unix locale names, except for a few cases which have
already been properly supported on Windows.  This way code like

  setlocale(LC_ALL, 'de_DE.UTF-8', 'de_DE', 'German_Germany.1252');

should work like on older Windows systems.

It should be noted that the locale names causing trouble are not (yet)
documented as valid names anyway, see
<https://docs.microsoft.com/en-us/cpp/c-runtime-library/locale-names-languages-and-country-region-strings?view=vs-2019>.
@petk petk added the Bug label May 16, 2019
@cmb69
Copy link
Member Author

cmb69 commented Jun 5, 2019

If there are no objections, I'll merge that early on Tuesday (before 7.2.20RC1 and 7.3.7RC1 will be tagged).

@cmb69
Copy link
Member Author

cmb69 commented Jun 11, 2019

Applied as f3ff72e.

@cmb69 cmb69 closed this Jun 11, 2019
@cmb69 cmb69 deleted the fix-77937 branch June 11, 2019 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants