Re: Problem of a server gettext message.

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: "Hiroshi Saito" <z-saito(at)guitar(dot)ocn(dot)ne(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Problem of a server gettext message.
Date: 2007-12-10 18:25:53
Message-ID: 200712101925.53865.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Am Montag, 10. Dezember 2007 schrieb Hiroshi Saito:
> Hi.
>
> From: "Peter Eisentraut" <peter_e(at)gmx(dot)net>
>
> > Am Montag, 10. Dezember 2007 schrieb Hiroshi Saito:
> >> Hi Peter-san.
> >>
> >> It is this.
> >> http://winpg.jp/~saito/pg83/ja.zip
> >
> > Sorry, we need the *po* (text) files, not the *mo* (binary) files.
>
> Ooops, Although it is an object for Version 8.2.5.
> http://www.postgresql.jp/wg/jpugdoc/po/postgresql-8-2-5-nls-patch.gz

OK, you have

PO file in EUC-JP
server encoding UTF-8
client encoding SJIS

When the server wants to send an error message to the client, it will convert
them from the server to the client encoding. The English messages are ASCII,
so this will work, because server encodings are required to be ASCII
compatible. The result of the gettext calls, however, is encoded in EUC-JP,
so the server will take the EUC-JP bytes and attempt to do a UTF-8 to SJIS
conversion on them. This will cause a crash.

What you need to do is set the locale to something compatible with the server
encoding (e.g., ja_JP.utf8). Then gettext will recode its EUC-JP data to
UTF-8 before it is sent to the server. More specifically, you need to set
the LC_CTYPE locale category to make this happen. I understand that users in
Japanese environments like to keep the LC_COLLATE setting to C, and you
should still be able to do that. But without a proper LC_CTYPE setting, this
will not work.

(That is the explanation for Linux. Windows might be different in the
details, but I suspect it has the same mechanisms.)

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2007-12-10 18:36:02 Re: archive_command failures report confusing exit status
Previous Message Erik Jones 2007-12-10 18:21:34 Re: partitioned table query question