Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] trouble with to_char('L')

From: Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Mikko <mhannesy(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [GENERAL] trouble with to_char('L')
Date: 2010-03-01 11:00:15
Message-ID: 4B8B9E3F.6060605@tpf.co.jp (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-hackers
Bruce Momjian wrote:
> Bruce Momjian wrote:
>> 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.
> 
> 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?

> 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.

regards,
Hiroshi Inoue

In response to

Responses

pgsql-hackers by date

Next:From: Yeb HavingaDate: 2010-03-01 11:18:01
Subject: Polyplanner (was Re: Avoiding bad prepared-statement plans.)
Previous:From: Yeb HavingaDate: 2010-03-01 09:55:46
Subject: Re: C libpq frontend library fetchsize

pgsql-general by date

Next:From: AI RummanDate: 2010-03-01 12:08:01
Subject: current transaction id
Previous:From: Darryl PyeDate: 2010-03-01 10:19:31
Subject: Cannot remove prepared statement.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group