X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 39D82D85C7; Thu, 8 Sep 2005 10:24:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95801-07; Thu, 8 Sep 2005 13:24:41 +0000 (GMT) Received: from mx1.surnet.cl (mx2.surnet.cl [216.155.73.181]) by svr1.postgresql.org (Postfix) with ESMTP id 59332D8479; Thu, 8 Sep 2005 10:24:42 -0300 (ADT) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx1.surnet.cl with ESMTP; 08 Sep 2005 09:24:35 -0400 X-IronPort-AV: i="3.96,179,1122868800"; d="scan'208"; a="6646231:sNHT35435952" Received: from alvh.no-ip.org (216.155.85.134) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 4317C634000BD6B2; Thu, 8 Sep 2005 09:24:45 -0400 Received: by alvh.no-ip.org (Postfix, from userid 1000) id 45090C2DC74; Thu, 8 Sep 2005 09:25:44 -0400 (CLT) Date: Thu, 8 Sep 2005 09:25:44 -0400 From: Alvaro Herrera To: "Pradeepkumar, Pyatalo (IE10)" Cc: pgsql-admin@postgresql.org, pgsql-novice@postgresql.org Subject: Re: Please help - libpq API Message-ID: <20050908132544.GC12971@surnet.cl> Mail-Followup-To: "Pradeepkumar, Pyatalo (IE10)" , pgsql-admin@postgresql.org, pgsql-novice@postgresql.org References: <77ED2BF75D59D1439F90412CC5B109742415CA8D@ie10-sahara.hiso.honeywell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <77ED2BF75D59D1439F90412CC5B109742415CA8D@ie10-sahara.hiso.honeywell.com> User-Agent: Mutt/1.5.10i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.342 required=5 tests=[AWL=-0.484, DNS_FROM_RFC_ABUSE=0.374, DNS_FROM_RFC_POST=1.376, FORGED_RCVD_HELO=0.05, RCVD_IN_NJABL_PROXY=1.026] X-Spam-Level: ** X-Archive-Number: 200509/75 X-Sequence-Number: 18812 On Wed, Sep 07, 2005 at 11:40:57PM -0700, Pradeepkumar, Pyatalo (IE10) wrote: > I have already posted my query regarding libpq functions and wide character > support. Pls somebody help me. I am using libpq API functions in my C code > to do operations on the database. But the problem I m facing is API > functions like PQexec() etc....accept only char * .... but as part of > localization, the queries I want to executed contain chinese characters > which are multibytes. So the queries I want to execute are in wchar_t * > format and PQ exec() accepts only char *. Is there any alternate way to > execute queries having wide characters. I think you could be using PQexecParams() and passing your wide-char strings as binary parameters somehow. I don't really know if this will work or not, but it may give you an idea. But note below: > Even if somehow if I convert wchar_t * to char * and provide it to > Postgres, how will it differentiate between chinese characters and normal > characters ?? Please note that any string you pass from the client will be interpreted using the client_encoding setting. So maybe what you have to do is just set client_encoding to the encoding that the strings are encoded in. If you choose the wrong client_encoding, the server may recode the characters inappropiately, or not at all, and thus insert wrong data. Please see the documentation. -- Alvaro Herrera -- Valdivia, Chile Architect, www.EnterpriseDB.com "When the proper man does nothing (wu-wei), his thought is felt ten thousand miles." (Lao Tse)