Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 22051B5DC0A for ; Wed, 12 Oct 2011 23:51:49 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 37681-03 for ; Thu, 13 Oct 2011 02:51:42 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from mail-gy0-f174.google.com (mail-gy0-f174.google.com [209.85.160.174]) by mail.postgresql.org (Postfix) with ESMTP id 74E76B5DBF4 for ; Wed, 12 Oct 2011 23:51:38 -0300 (ADT) Received: by gyb13 with SMTP id 13so1338140gyb.19 for ; Wed, 12 Oct 2011 19:51:38 -0700 (PDT) Received: by 10.236.154.228 with SMTP id h64mr2145292yhk.77.1318474298482; Wed, 12 Oct 2011 19:51:38 -0700 (PDT) Received: from ayaki.localdomain ([202.81.69.135]) by mx.google.com with ESMTPS id o7sm11894014anp.18.2011.10.12.19.51.36 (version=SSLv3 cipher=OTHER); Wed, 12 Oct 2011 19:51:37 -0700 (PDT) Message-ID: <4E965236.6050307@ringerc.id.au> Date: Thu, 13 Oct 2011 10:51:34 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0) Gecko/20110927 Thunderbird/7.0 MIME-Version: 1.0 To: bushcraftrelf CC: pgsql-bugs@postgresql.org Subject: Re: BUG #6246: character encoding for 64 bit References: <201110100820.p9A8KWOu064380@wwwmaster.postgresql.org> <4E9577B30200002500041EB4@gw.wicourts.gov> <1318446545797-4896599.post@n5.nabble.com> In-Reply-To: <1318446545797-4896599.post@n5.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201110/105 X-Sequence-Number: 31375 On 10/13/2011 03:09 AM, bushcraftrelf wrote: > > Kevin Grittner wrote: >> >> >> WIN1512 supports characters which are not supported by LATIN1. If >> you sent such characters to the database, what would you expect to >> happen? >> >> -Kevin >> > > Hi Kevin, > > I forgot to mention a few things. One is that the problem only arises in > postgres 9.1 - I can create exactly the same databases and tables in 9.0 and > have no problems accessing them using psql 9.0. > Also, I set the client_encoding to "LATIN1" and so there should have been no > problem with a mismatch in encoding. Actually, there still is, because your terminal isn't speaking latin1 so either it'll have errors when converting from the WINxxxx terminal encoding to latin1 or characters will be corrupted where they're not the same in both encodings. Even if it seemed to work, unless you set your *terminal* to latin1 as well it'd produce wrong results. psql may want to `chcp 65001' to put the shell in unicode mode. You may also need to select a Unicode font for the shell. I seem to recall that "cmd /u" is also useful in some way, but I'm not in front of Windows at the moment so I can't check. > The main difference I have found (if it's any use) is that when I first open > psql 9.0, the \encoding is always set at UTF8 until I change it (which > postgres can convert to LATIN1). When I first open psql 9.1, the \encoding > is set at WIN1252 before I change it. WIN1252 cannot be converted to LATIN1. It sounds like psql on 9.1 is correctly detecting the shell's encoding, wheras 9.0 is assuming utf-8. Whoopsie! If that's the case, try running "chcp 65001" before "psql". See if that helps. -- Craig Ringer