Re: [GENERAL] trouble with to_char('L')
Bruce Momjian <bruce@momjian.us>
From: Bruce Momjian <bruce@momjian.us>
To: Hiroshi Inoue <inoue@tpf.co.jp>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Alvaro Herrera <alvherre@commandprompt.com>, Mikko <mhannesy@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2010-03-02T18:14:00Z
Lists: pgsql-hackers, pgsql-general
Attachments
- /pgpatches/pg_locale (text/x-diff) patch
Hiroshi Inoue wrote: > >>>> I need someone with WIN32 experience to review and test this patch. > >>> I don't understand why cache_locale_time() works on Windows. It sets > >>> the LC_CTYPE but does not do any encoding coversion. > >> Doesn't strftime_win32 do the conversion? > > > > Oh, I now see strftime is redefined as a macro in that C files. Thanks. > > > >>> Do month and > >>> day-of-week names not work either, or do they work and the encoding > >>> conversion for numeric/money, e.g. Euro, it not necessary? > >> db_strdup does the conversion. > > > > Should we pull the encoding conversion into a separate function and have > > strftime_win32() and db_strdup() both call it? > > We may be able to pull the conversion WideChars => UTF8 => > a PG encoding into an function. OK, I have created a new function, win32_wchar_to_db_encoding(), to share the conversion from wide characters to the database encoding. New patch attached. > BTW both PGLC_localeconv() and cache_locale_time() save the current > LC_CTYPE first and restore them just before returning the functions. > I'm suspicious if it's OK when errors occur in middle of the functions. Yea, I added a comment questioning if that is a problem. -- Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB http://enterprisedb.com PG East: http://www.enterprisedb.com/community/nav-pg-east-2010.do