Re: Solve a problem of LC_TIME of windows.

From: Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp>
To: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: Hiroshi Saito <z-saito(at)guitar(dot)ocn(dot)ne(dot)jp>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Solve a problem of LC_TIME of windows.
Date: 2009-01-07 16:37:22
Message-ID: 4964DA42.9040401@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

ITAGAKI Takahiro wrote:
> Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp> wrote:
>
>> Seems LC_CTYPE and LC_TIME should be convertible even though we use
>> wcsftime (which internally calls strftime?).
>
> Ok, wcsftime() requries both LC_TIME and LC_CTYPE are the same setting
> (at least encoding) on Windows.
>
> The attached patch is an updated version to fix cache_locale_time().
> Now it sets LC_TIME and LC_CTYPE to the specified locale and restore
> them at end of the function. I tested the patch on Windows XP Japanese
> Edition (SJIS) with UTF-8 and EUCJP databases, and worked expectedly.

I've also thought a similar implementation but there seems
a problem of efficiency.
As far as I see wcsftime() is almost = strftime() + mbstowcs()
and so using strftime() is effective at least for the following
cases.

1) LC_CTIME is "C".
2) LC_CTYPE != C and the database encoding != UTF-8. In this
case the current restriction of PostgreSQL requires that
the database encoding matches the encoding of the LC_CTYPE.

We seem to be able to call strftime() directly in above cases.

Comments ?

regards,
Hiroshi Inoue

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2009-01-07 16:37:30 Re: about truncate
Previous Message Sam Mason 2009-01-07 16:21:41 Re: float8 strtod weirdness

Browse pgsql-patches by date

  From Date Subject
Next Message Hiroshi Saito 2009-01-07 16:44:31 Re: Solve a problem of LC_TIME of windows.
Previous Message Magnus Hagander 2009-01-07 13:25:01 Re: Solve a problem of LC_TIME of windows.