Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBRNaXL51628 for ; Wed, 27 Dec 2000 18:36:34 -0500 (EST) (envelope-from t-ishii@sra.co.jp) Received: from sranhk.sra.co.jp (sranhk [133.137.36.134]) by sraigw.sra.co.jp (8.8.7/3.7W-sraigw) with ESMTP id IAA09878 for ; Thu, 28 Dec 2000 08:36:47 +0900 (JST) Received: from localhost (IDENT:t-ishii@portsv3-8 [133.137.84.8]) by sranhk.sra.co.jp (8.9.3/3.7W-srambox) with ESMTP id IAA06645; Thu, 28 Dec 2000 08:36:44 +0900 To: cch@cc.kmu.edu.tw Cc: pgsql-hackers@postgresql.org Subject: Re: About PQsetClientEncoding(),"SET NAMES",and "SET CLIENT_ENCODING" In-Reply-To: <3A49D8C3.5498BA62@cc.kmu.edu.tw> References: <20001117112855H.t-ishii@sra.co.jp> <20001222171001Q.t-ishii@sra.co.jp> <3A49D8C3.5498BA62@cc.kmu.edu.tw> X-Mailer: Mew version 1.94.2 on Emacs 20.7 / Mule 4.1 =?iso-2022-jp?B?KBskQjAqGyhCKQ==?= Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20001228083641E.t-ishii@sra.co.jp> Date: Thu, 28 Dec 2000 08:36:41 +0900 From: Tatsuo Ishii X-Dispatcher: imput version 20000228(IM140) Lines: 17 X-Archive-Number: 200012/1025 X-Sequence-Number: 2554 > For example: If we use PHP (>4.0.2), which way is correct or mostly correct? > > 1. pg_setclientencoding($cid, "BIG5") > 2. pg_exec("SET NAMES 'BIG5'") > 3. pg_exec("SET CLIENT_ENCODING TO 'BIG5'") 2 and 3 are actually identical: telling the backend "Your client's encoding is BIG5, so you need to convert EUC_TW to BIG5 before sending data to the client. Also you need to convert BIG5 to EUC_TW when receiving data from him." 1 is doing the same thing as 2 or 3 AND set the internal encoding of libpq, which is linked to PHP, to BIG5. This is neccesary in case of the second byte of BIG5 character is "\" or one of other control characters. -- Tatsuo Ishii