From mmalik_altaf@yahoo.com Tue May 1 15:29:22 2007 Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 56CA49FB763 for ; Tue, 1 May 2007 12:29:22 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 69162-06 for ; Tue, 1 May 2007 12:29:17 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from web39107.mail.mud.yahoo.com (web39107.mail.mud.yahoo.com [209.191.87.226]) by postgresql.org (Postfix) with SMTP id C5BFF9FB214 for ; Tue, 1 May 2007 12:29:17 -0300 (ADT) Received: (qmail 14570 invoked by uid 60001); 1 May 2007 15:29:16 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=PnTO58iuoP78XJ6833eMppzx/PG1yvWUfNl5BrNfuXg/YHh3XpIB2XuSnjDM3W7/9p1TZABdkzFXDBQwQKgRYu8vvcAgtM4zFJKdQ4ygda3zkdZqpEVlx3GZNrlMULcjTO/16ufTimUr1Ce7P+8PhSW0YIHHqmPsGCXC6gEvMCU=; X-YMail-OSG: ZA1jaX4VM1morxmuzG.livZwCB9olYOPyovi_iFfdpLoAHTg3o8qmWEHJKY_Hty7CI_wk5qLClKz8ZYV_0FwPPJIEUBFs6sy05TN9O0mgVPZW3F1QPzJHPOZ6d3oJA-- Received: from [203.215.160.146] by web39107.mail.mud.yahoo.com via HTTP; Tue, 01 May 2007 08:29:16 PDT Date: Tue, 1 May 2007 08:29:16 -0700 (PDT) From: Altaf Malik Subject: JDBC Default Encoding To: pgsql-jdbc@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1067391780-1178033356=:13890" Content-Transfer-Encoding: 8bit Message-ID: <380653.13890.qm@web39107.mail.mud.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.655 tagged_above=0 required=5 tests=AWL=-0.591, BAYES_05=-1.11, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708, DNS_FROM_RFC_WHOIS=1.447, HTML_MESSAGE=0.001 X-Spam-Level: * X-Archive-Number: 200705/5 X-Sequence-Number: 16995 --0-1067391780-1178033356=:13890 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi, In PGStream, i see the default encoding "US-ASCII" which is overridden once we are connected to the database. But, if an error comes while connecting to the database for example user name is not correct, US-ASCII is used to decode the Server Message which prints ??? instead of actual error message when the locale is other than english (in my case it was zh_TW.utf8). If i change the default encoding of PGStream to UTF8, it works fine. Is there any specific reason for the default encoding to be the US-ASCII? --Altaf Malik --------------------------------- Ahhh...imagining that irresistible "new car" smell? Check outnew cars at Yahoo! Autos. --0-1067391780-1178033356=:13890 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi,
 In PGStream, i see the default encoding "US-ASCII" which is overridden once we are connected to the database. But, if an error comes while connecting to the database for example user name is not correct, US-ASCII is used to decode the Server Message which prints ??? instead of actual error message when the locale is other than english (in my case it was zh_TW.utf8). If i change the default encoding of PGStream to UTF8, it works fine. Is there any specific reason for the default encoding to be the US-ASCII?

--Altaf Malik


Ahhh...imagining that irresistible "new car" smell?
Check out new cars at Yahoo! Autos. --0-1067391780-1178033356=:13890-- From books@ejurka.com Tue May 1 16:05:14 2007 Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 6CE3A9FB3DD for ; Tue, 1 May 2007 13:05:14 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 65958-02 for ; Tue, 1 May 2007 13:05:09 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail63.csoft.net (leary.csoft.net [205.205.214.5]) by postgresql.org (Postfix) with SMTP id B849D9FB4E4 for ; Tue, 1 May 2007 13:05:09 -0300 (ADT) Received: (qmail 32143 invoked by uid 1112); 1 May 2007 16:05:08 -0000 Date: Tue, 1 May 2007 12:05:08 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Altaf Malik cc: pgsql-jdbc@postgresql.org Subject: Re: JDBC Default Encoding In-Reply-To: <380653.13890.qm@web39107.mail.mud.yahoo.com> Message-ID: References: <380653.13890.qm@web39107.mail.mud.yahoo.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/6 X-Sequence-Number: 16996 On Tue, 1 May 2007, Altaf Malik wrote: > In PGStream, i see the default encoding "US-ASCII" which is overridden > once we are connected to the database. But, if an error comes while > connecting to the database for example user name is not correct, > US-ASCII is used to decode the Server Message which prints ??? instead > of actual error message when the locale is other than english (in my > case it was zh_TW.utf8). If i change the default encoding of PGStream to > UTF8, it works fine. Is there any specific reason for the default > encoding to be the US-ASCII? > Prior to connecting to the database we cannot assume what encoding the conversation should occur in, so we use the lowest common denominator of US-ASCII. I guess the question is, with a database encoding of something other than UTF-8, does the error message come back in the database encoding or in UTF-8 like we asked. I'm not sure when the server applies our setting of client_encoding. If it does come back in UTF-8 that would be a good reason to switch to UTF-8 in the driver earlier, but if it comes back in the database encoding there's not much we can do about that. Kris Jurka From tgl@sss.pgh.pa.us Tue May 1 16:34:31 2007 Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 697479FB2F5 for ; Tue, 1 May 2007 13:34:31 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 78009-03 for ; Tue, 1 May 2007 13:34:27 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id BC5E99FAC9B for ; Tue, 1 May 2007 13:34:27 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l41GYPv5018203; Tue, 1 May 2007 12:34:25 -0400 (EDT) To: Kris Jurka cc: Altaf Malik , pgsql-jdbc@postgresql.org Subject: Re: JDBC Default Encoding In-reply-to: References: <380653.13890.qm@web39107.mail.mud.yahoo.com> Comments: In-reply-to Kris Jurka message dated "Tue, 01 May 2007 12:05:08 -0400" Date: Tue, 01 May 2007 12:34:25 -0400 Message-ID: <18202.1178037265@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/7 X-Sequence-Number: 16997 Kris Jurka writes: > I'm not sure when the server applies > our setting of client_encoding. Immediately after switch scanning in PostgresMain, assuming you're sending it the way I think. This is before the backend subprocess attempts to verify the database or user name ... however, this is after authentication (pg_hba.conf processing) so there's quite a variety of failure messages that would be sent in the postmaster's default encoding, whatever that might be. I'm afraid there's not any really clean answer there. regards, tom lane