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-02-28T04:28:12Z
Lists: pgsql-hackers, pgsql-general

Attachments

Hiroshi Inoue wrote:
> Bruce Momjian wrote:
> > Hiroshi Inoue wrote:
> >> Bruce Momjian wrote:
> >>> Where are we on this issue?
> >> Oops I forgot it completely.
> >> I have a little improved version and would post it tonight.
> > 
> > Ah, very good.  Thanks.
> 
> Attached is an improved version.

I spent many hours on this patch and am attaching an updated version.
I have restructured the code and added many comments, but this is the
main one:

	*  Ideally, the server encoding and locale settings would
	*  always match.  Unfortunately, WIN32 does not support UTF-8
	*  values for setlocale(), even though PostgreSQL runs fine with
	*  a UTF-8 encoding on Windows:
	*
	*      http://msdn.microsoft.com/en-us/library/x99tb11d.aspx
	*
	*  Therefore, we must set LC_CTYPE to match LC_NUMERIC and
	*  LC_MONETARY, call localeconv(), and use mbstowcs() to
	*  convert the locale-aware string, e.g. Euro symbol, which
	*  is not in UTF-8 to the server encoding.

I need someone with WIN32 experience to review and test this patch.

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

  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do