On Fri, Apr 10, 2020 at 5:33 PM Amit Kapila <amit.kapil...@gmail.com> wrote:
>
> It seems the right direction to use GetLocaleInfoEx as we have already
> used it to handle a similar problem (lc_codepage is missing in
> _locale_t in higher versions of MSVC (cf commit 0fb54de9aa)) in
> chklocale.c.  However, I see that we have added a manual parsing there
> if GetLocaleInfoEx doesn't parse it.  I think that addresses your
> concern for _create_locale handling bigger sets.  Don't we need
> something equivalent here for the cases which GetLocaleInfoEx doesn't
> support?
I am in investigating in similar lines, I think the following explanation
can help.
>From Microsoft doc.
The locale argument to the setlocale, _wsetlocale, _create_locale, and
_wcreate_locale is
locale :: "locale-name"
    | *"language[_country-region[.code-page]]"*
    | ".code-page"
    | "C"
    | ""
    | NULL

For GetLocaleInfoEx locale argument is
*<language>-<REGION>*
<language>-<Script>-<REGION>

As we can see _create_locale will also accept the locale appended with
code-page but that is not the case in lateral.
The important point is in our current issue we need locale name only and
both
functions(GetLocaleInfoEx, _create_locale) support an equal number of
locales
names if go by the syntax of the locale described on Microsoft documents.
With that thought, I am parsing the input
string to remove the code-page and give it as input to GelLocaleInfoEx.
I have attached the new patch.

> How have you ensured the testing of this code?  I see that we have
> src\test\locale in our test directory.  Can we test using that?
I don't know how to use these tests on windows, but I had a look in these
tests, I didn't found any test which could hit the function we are
modifying.
I m still working on testing this patch. If anyone has Idea please suggest.

[1] https://docs.microsoft.com/en-us/windows/win32/intl/locale-names
[2]
https://docs.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getlocaleinfoex
[3]
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/create-locale-wcreate-locale?view=vs-2019
-- 
Regards,
Davinder
EnterpriseDB: http://www.enterprisedb.com

Attachment: 0001-PG-compilation-error-with-VS-2015-2017-2019_v03.patch
Description: Binary data

Reply via email to