pg.ddx.io  pgsql-patches@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hiroshi Inoue <inoue@tpf.co.jp>
To: ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp>
Cc: Hiroshi Saito <z-saito@guitar.ocn.ne.jp>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Solve a problem of LC_TIME of windows.
Date: Thu, 08 Jan 2009 01:37:22 +0900
Message-ID: <4964DA42.9040401@tpf.co.jp> (raw)
In-Reply-To: <20090107140111.810A.52131E4D@oss.ntt.co.jp>
References: <20081126174021.EFC6.52131E4D@oss.ntt.co.jp>
	<492D1707.3060403@tpf.co.jp>
	<20090107140111.810A.52131E4D@oss.ntt.co.jp>

ITAGAKI Takahiro wrote:
> Hiroshi Inoue <inoue@tpf.co.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



view thread (45+ messages)  latest in thread

Message-ID: <4964DA42.9040401@tpf.co.jp>
Permalink:  ../4964DA42.9040401@tpf.co.jp/
Also on:    postgresql.org/message-id/4964DA42.9040401@tpf.co.jp

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-patches@postgresql.org
  Cc: inoue@tpf.co.jp, itagaki.takahiro@oss.ntt.co.jp, z-saito@guitar.ocn.ne.jp, pgsql-hackers@postgresql.org
  Subject: Re: Solve a problem of LC_TIME of windows.
  In-Reply-To: <4964DA42.9040401@tpf.co.jp>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox