(2011/04/20 15:30), Heikki Linnakangas wrote:
> On 20.04.2011 06:48, Hiroshi Inoue wrote:
>> I can find no concrete reference to problems about locale
>>    names containing dots. Is the following an example?
> 
> Yes.
> 
>> In my environment (Windows Vista using VC8)
>>
>>     setlocale(LC_XXXX, "Chinese (Traditional)_MCO.950");
>> works and
>>     setlocale(LC_XXXX, NULL);
>> returns
>>     Chinese (Traditional)_Macao S.A.R..950

but
  setlocale(LC_XXXX, "Chinese (Traditional)_Macao S.A.R..950");
fails.

I see another issue for the behavior.

For example, the following code in src/backend/utis/adt/pg_locale.c
won't work as expected in case the current locale is Hong Kong, Macao or
UAE because the last setlocale() in the code would fail. I can
find such save & restore operations of locales in several places.

bool
check_locale(int category, const char *value)
{
        char       *save;
        bool            ret;

        save = setlocale(category, NULL);
        if (!save)
                return false;                   /* won't happen, we hope */

        /* save may be pointing at a modifiable scratch variable, see above */
        save = pstrdup(save);

        /* set the locale with setlocale, to see if it accepts it. */
        ret = (setlocale(category, value) != NULL);

        setlocale(category, save);      /* assume this won't fail */
        pfree(save);

        return ret;
}

regards,
Hiroshi Inoue

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to