Re: encoding of PostgreSQL messages

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp>, Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: encoding of PostgreSQL messages
Date: 2009-02-08 09:25:56
Message-ID: 498EA524.9020004@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bruce Momjian wrote:
> Can someone comment on this?

Looks like a horrible hack to me. Recoding stuff to the client encoding
in the server outside the existing recoding mechanism looks pretty evil
to me. Plus, it does not address the problem of what happens to
messages sent before this, it just moves the point of "before" a bit
earlier for some special cases.

I think we have discussed more proper solutions earlier in this thread.
IMO the best approach would be for the client to include the client
encoding in the startup package.

>
> ---------------------------------------------------------------------------
>
> Hiroshi Inoue wrote:
>> Hi,
>>
>> This topic seems to be related to the bug report
>> [ODBC] Localized error messages, wrong charset
>> .
>>
>> Bruce Momjian wrote:
>>> Added to TODO:
>>>
>>> Improve encoding of connection startup messages sent to the client
>>>
>>> Currently some authentication error messages are sent in the server
>>> encoding
>> It it true ?
>> IIRC the backend knows nothing about the server encoding in
>> authentication phase.
>>
>> Psqlodbc Unicode driver sends connection startup message which
>> contains the client_encoding(=UTF8) guc parameter. Attached is
>> a trial patch so that the psqlodbc Unicode driver can get
>> properly localized password error messages.
>>
>> regards,
>> Hiroshi Inoue
>
>> Index: postmaster/postmaster.c
>> ===================================================================
>> RCS file: /projects/cvsroot/pgsql/src/backend/postmaster/postmaster.c,v
>> retrieving revision 1.570
>> diff -c -c -r1.570 postmaster.c
>> *** postmaster/postmaster.c 4 Jan 2009 22:19:59 -0000 1.570
>> --- postmaster/postmaster.c 30 Jan 2009 14:05:35 -0000
>> ***************
>> *** 1552,1557 ****
>> --- 1552,1560 ----
>> pstrdup(nameptr));
>> port->guc_options = lappend(port->guc_options,
>> pstrdup(valptr));
>> + if (stricmp(nameptr, "client_encoding") == 0 &&
>> + stricmp(valptr, "UTF8") == 0)
>> + bind_textdomain_codeset(PG_TEXTDOMAIN("postgres"), "UTF-8");
>> }
>> offset = valoffset + strlen(valptr) + 1;
>> }
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Iñigo Barandiaran 2009-02-08 12:04:53 Re: Install Postgre while installing Other software.
Previous Message rhubbell 2009-02-08 05:33:36 Re: Pet Peeves?