Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 6F2E3B5DBBD for ; Fri, 10 Jun 2011 09:41:08 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 37241-06 for ; Fri, 10 Jun 2011 12:41:01 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34]) by mail.postgresql.org (Postfix) with SMTP id 3C5DBB5DBB7 for ; Fri, 10 Jun 2011 09:40:59 -0300 (ADT) Received: (qmail 10665 invoked by uid 512); 10 Jun 2011 12:40:55 -0000 X-Authentication: inoue was authenticated by sd.tpf.co.jp at 10 Jun 2011 12:40:55 -0000 Received: from unknown (HELO ?192.168.24.54?) (183.76.23.68) by sd.tpf.co.jp with SMTP; 10 Jun 2011 12:40:55 -0000 Message-ID: <4DF210D5.2020009@tpf.co.jp> Date: Fri, 10 Jun 2011 21:40:53 +0900 From: Hiroshi Inoue User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; ja; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: =?KOI8-R?Q?=F0=CF=D0=CF=D7_=ED=C9=C8=C1=C9=CC_=E0=D2=D8=C5=D7=C9=DE?= CC: "pgsql-odbc@postgresql.org" Subject: Re: Client encoding win866. References: <27EFDA7DA70C1E409421B31ECAA8C9D31DD83EDF90@topmail6> <4DEE3821.8010801@tpf.co.jp> <27EFDA7DA70C1E409421B31ECAA8C9D31DD83EE285@topmail6> <4DEF7DF5.6010505@tpf.co.jp> <27EFDA7DA70C1E409421B31ECAA8C9D31DD83EE439@topmail6> In-Reply-To: <27EFDA7DA70C1E409421B31ECAA8C9D31DD83EE439@topmail6> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.242 tagged_above=-10 required=5 tests=BAYES_00=-1.9, DNS_FROM_RFC_BOGUSMX=1.668, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/11 X-Sequence-Number: 10669 (2011/06/09 18:34), Попов Михаил Юрьевич wrote: > > >>> Few details... >>> I create connection and before all the bindings of parameters and columns, and before SQLPrepare I do SQLExecDirect(stmthp,"set client_encoding to \"WIN866\";",SQL_NTS); >>> Then after SQLPrepare, SQLBindParameter and after SQLExecute I get an error: >>> Error code 22P05 with message ERROR: character 0x83 of encoding "WIN1251" has no equivalent in "MULE_INTERNAL"; >>> >>> In this example, the function I pass the 'select * from "Table"' > >> What will happen when you don't call *set client_encoding to ...*? > > Yes, I understood and found a bug in my code. And now schema by using "set client_encoding to \"WIN866\";" worked correctly. Thanks. > > But while I was searching for a solution, I found the documentation and tried it through a variable PGCLIENTENCODING change the encoding. > http://www.postgresql.org/docs/8.1/static/multibyte.html > --- > Using PGCLIENTENCODING. If the environment variable PGCLIENTENCODING is defined in the client's environment, that client encoding is automatically selected when a connection to the server is made. (This can subsequently be overridden using any of the other methods mentioned above.) > > Using the configuration variable client_encoding. If the client_encoding variable is set, that client encoding is automatically selected when a connection to the server is made. (This can subsequently be overridden using any of the other methods mentioned above.) > --- > I set environment variable at 'WIN866', as well set the database properties "ALTER DATABASE "DD866" SET client_encoding='WIN866'". But it did not work. And without *set client_encoding to ...* don't work. > This mechanism would be more optimal for my project, because now, for each cursor must run the command *set client_encoding to ...*. Or is this another question? If you connect via DSN, please look at the page http://www.ne.jp/asahi/inocchichichi/entrance/psqlodbc/index.html . regards, Hiroshi Inoue