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

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


"Hiroshi Saito" <z-saito(at)guitar(dot)ocn(dot)ne(dot)jp> wrote:

> Um, It was not supported.
> http://winpg.jp/~saito/pg_work/LC_MESSAGE_CHECK/LC_TIME_PATCH/ITAGAKI_PATCH.txt

Hmm... the implementation of wcsftime() in msvcrt seems to be
completely broken.

I ran the attached test (localetest.c) and got the following results.
The point is that wcsftime() returns the same character codes as strftime()
i.e, the result is not an unicode string :-(

The bug might be fixed in recently msvcrts in VC2005 or VC2008,
but at least mingw uses the old broken C runtime. We'd better to
use strftime() and multiple conversions to avoid the Microsoft's bug.

----
locale: C
[Wednesday]
C:str = 57 65 64 6e 65 73 64 61 79
C:wcs = 57 65 64 6e 65 73 64 61 79
locale: Japanese_Japan.932
SJIS:str = 90 85 97 6a 93 fa
SJIS:wcs = 90 85 97 6a 93 fa
locale: Japanese_Japan.20932
EUCJP:str = 90 85 97 6a 93 fa
EUCJP:wcs = 90 85 97 6a 93 fa
----

NOTE: There is another problem that specified encoding is ignored
by the functions. The result encoding is always platform default one.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

Attachment Content-Type Size
localetest.c application/octet-stream 1.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2008-11-26 03:41:11 Re: Column reordering in pg_dump
Previous Message Dann Corbit 2008-11-26 02:59:25 Re: Simple postgresql.conf wizard -- Statistics idea...

Browse pgsql-patches by date

  From Date Subject
Next Message Hiroshi Inoue 2008-11-26 05:10:58 Re: [PATCHES] Solve a problem of LC_TIME of windows.
Previous Message Hiroshi Saito 2008-11-25 13:03:52 Re: [PATCHES] Solve a problem of LC_TIME of windows.