Re: [PATCHES] Solve a problem of LC_TIME of windows.

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Hiroshi Saito <z-saito(at)guitar(dot)ocn(dot)ne(dot)jp>
Cc: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCHES] Solve a problem of LC_TIME of windows.
Date: 2008-11-24 13:02:05
Message-ID: 492AA5CD.8050001@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

The way I read this patch we do:
1) Get the time in CP_ACP
2) Convert to UTF16
3) Convert to UTF8
4) If necessary, convert to the charset in the database

We could be more efficient by at least folding 1 and 2 into a single
step, which means getting it in UTF16 from the beginning. How about
attached patch? It builds, but please verify that it fixes the problem.

(I've updated the comment as well)

Attached pg_locale_utf16.patch. I'm also attaching
pg_locale_diffdiff.patch which contains the changes I've made against
your patch only.

//Magnus

Hiroshi Saito wrote:
> Hi.
>
> All suggestion is appropriate and has been checked.
>
> CVS-HEAD was examined by MinGW. $ make check NO_LOCALE=true
> ...
> =======================
> All 118 tests passed. =======================
>
> Then, It continues and a review is desired. Thanks!
>
> Regatrds,
> Hiroshi Saito
>
> ----- Original Message ----- From: "Hiroshi Saito"
> <z-saito(at)guitar(dot)ocn(dot)ne(dot)jp>
>
>
>> Hi ITAGAKI-san.
>>
>> Sorry, very late reaction..
>> I lost time resources in an individual my machine trouble and
>> busyness.:-(
>> Now, I appreciate your exact work. ! Then, I desire the best patch for
>> PostgreSQL. Probably, I think that it is finally helpful in not a
>> problem of only Japan but many countries. Tom-san, and Alvaro-san,
>> Magnus-san understands the essence of this problem. Therefore, the
>> suggestion is expected for me.
>> Anyway, thank you very much.!!
>>
>> Regards,
>> Hiroshi Saito
>>
>> ----- Original Message ----- From: "ITAGAKI Takahiro"
>> <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
>>
>>
>>>
>>> "Jaime Casanova" <jcasanov(at)systemguards(dot)com(dot)ec> wrote:
>>>
>>>> i'm confused, original patch has this signature:
>>>> + conv_strftime(char *src, size_t len, const char *format, const
>>>> struct tm *tm)
>>>> your's has:
>>>> +strftime_win32(char *dst, size_t dstlen, const char *format, const
>>>
>>>> you change all src for dst, just a variable name decision but a
>>>> radical one... why was that (i honestly doesn't understand this patch
>>>> very well ;)?
>>>
>>> That's because the first argument is not an input buffer,
>>> but an output buffer. MSDN also calls it 'strDest'.
>>> http://msdn.microsoft.com/en-us/library/fe06s4ak(VS.71).aspx
>>> Linux manpage calls it 's', but I think it means String, not Src.
>>> http://man.cx/strftime
>>>
>>> If you can review the patch, please use the attached one instead.
>>> I modified it in response to the discussion of
>>> pg_do_encoding_conversion.
>>>
>>>
>>> BTW, I cannot understand the comment in the function head,
>>>
>>> + * result is obtained by locale setup of LC_TIME in the environment
>>> + * of windows at present CP_ACP. Therefore, conversion is needed
>>> + * for SERVER_ENCODING. SJIS which is not especially made to server
>>> + * encoding in Japan returns.
>>> but it probably says:
>>>
>>> ----
>>> strftime in Windows returns in CP_ACP encoding, but it could be
>>> different from SERVER_ENCODING. Especially, Windows Japanese edition
>>> requires conversions because it uses SJIS as CP_ACP, but we don't
>>> support SJIS as a server encoding.
>>> ----
>>>
>>> I hope you would review my English not only C ;-)
>>>
>>> Regards,
>>> ---
>>> ITAGAKI Takahiro
>>> NTT Open Source Software Center
>>>
>>>
>>
>> --
>> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-hackers

Attachment Content-Type Size
pg_locale_utf16.patch text/x-diff 1.8 KB
pg_locale_diffdiff.patch text/x-diff 1.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message KaiGai Kohei 2008-11-24 13:09:02 Re: Updates of SE-PostgreSQL 8.4devel patches (r1197)
Previous Message KaiGai Kohei 2008-11-24 12:58:35 Updates of SE-PostgreSQL 8.4devel patches (r1244)

Browse pgsql-patches by date

  From Date Subject
Next Message Hiroshi Saito 2008-11-24 14:48:22 Re: [PATCHES] Solve a problem of LC_TIME of windows.
Previous Message Hiroshi Saito 2008-11-24 07:02:08 Re: [PATCHES] Solve a problem of LC_TIME of windows.