Re: [GENERAL] trouble with to_char('L') - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [GENERAL] trouble with to_char('L')
Date
Msg-id 201004201323.o3KDNjv28954@momjian.us
Whole thread Raw
In response to Re: [GENERAL] trouble with to_char('L')  (Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp>)
List pgsql-hackers
Takahiro Itagaki wrote:
> 
> Magnus Hagander <magnus@hagander.net> wrote:
> 
> > > 1. setlocale(LC_CTYPE, lc_monetary)
> > > 2. setlocale(LC_MONETARY, lc_monetary)
> > > 3. lc = localeconv()
> > > 4. pg_do_encoding_conversion(lc->xxx,
> > >      FROM pg_get_encoding_from_locale(lc_monetary),
> > >      TO GetDatabaseEncoding())
> > > 5. Revert LC_CTYPE and LC_MONETARY.
> 
> A patch attached for the above straightforwardly. Does this work?
> Note that #ifdef WIN32 parts in the patch are harmless on other platforms
> even if they are enabled.

I like this patch.  Instead of having special code to convert from the
_current_ locale, you pass the encoding name to our routines.  This does
mean we are bound by supporting only the encodings PG supports, not the
full range of Win32 encodings, but that seems fine.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] trouble with to_char('L')
Next
From: "Kevin Grittner"
Date:
Subject: Re: [DOCS] Streaming replication document improvements