Re: [bug fix] multibyte messages are displayed incorrectly on the client

From: "MauMau" <maumau307(at)gmail(dot)com>
To: "Noah Misch" <noah(at)leadboat(dot)com>, "Bruce Momjian" <bruce(at)momjian(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [bug fix] multibyte messages are displayed incorrectly on the client
Date: 2013-12-22 10:51:55
Message-ID: 2C7051B8F82C4461A1AB02FE9A2E8CF1@maumau
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From: "Noah Misch" <noah(at)leadboat(dot)com>
> Better to attack that directly. Arrange to apply any client_encoding
> named in
> the startup packet earlier, before authentication. This relates to the
> TODO
> item "Let the client indicate character encoding of database names, user
> names, and passwords". (I expect such an endeavor to be tricky.)

Unfortunately, character set conversion is not possible until the database
session is established, since it requires system catalog access. Please the
comment in src/backend/utils/mb/mbutils.c:

* During backend startup we can't set client encoding because we (a)
* can't look up the conversion functions, and (b) may not know the database
* encoding yet either. So SetClientEncoding() just accepts anything and
* remembers it for InitializeClientEncoding() to apply later.

I guess that's why Tom-san suggested the same solution as my patch (as a
compromise) in the below thread, which is also a TODO item:

Re: encoding of PostgreSQL messages
http://www.postgresql.org/message-id/19896.1234107496@sss.pgh.pa.us

From: "Alvaro Herrera" <alvherre(at)2ndquadrant(dot)com>
> The problem is that if there's an encoding mismatch, the message might
> be impossible to figure out. If the message is in english, at least it
> can be searched for in the web, or something -- the user might even find
> a page in which the english error string appears, with a native language
> explanation.

I feel like this, too. Being readable in English is better than being
unrecognizable.

Regards
MauMau

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2013-12-22 13:37:37 Re: WITHIN GROUP patch
Previous Message Fujii Masao 2013-12-22 09:31:43 Re: ALTER SYSTEM SET command to change postgresql.conf parameters