X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 48D6C475E77 for ; Fri, 25 Apr 2003 14:11:09 -0400 (EDT) Received: from post.webmailer.de (natsmtp01.webmailer.de [192.67.198.81]) by postgresql.org (Postfix) with ESMTP id 4203A474E42 for ; Fri, 25 Apr 2003 14:11:05 -0400 (EDT) Received: from iwate.ianb.homelinux.net (pD9E0ED56.dip.t-dialin.net [217.224.237.86]) by post.webmailer.de (8.12.8/8.8.7) with ESMTP id h3PIB3Ct022496; Fri, 25 Apr 2003 20:11:03 +0200 (MEST) From: Ian Barwick To: "prabahar" , pgsql-sql@postgresql.org Subject: Re: sorting chinese characters Date: Fri, 25 Apr 2003 20:10:11 +0200 User-Agent: KMail/1.5.1 References: <20030425082222.M48563@questech.co.in> In-Reply-To: <20030425082222.M48563@questech.co.in> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200304252010.11373.barwick@gmx.net> X-Spam-Status: No, hits=-37.2 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, RCVD_IN_NJABL,RCVD_IN_OSIRUSOFT_COM,REFERENCES, REPLY_WITH_QUOTES,USER_AGENT_KMAIL autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/383 X-Sequence-Number: 13084 On Friday 25 April 2003 10:22, prabahar wrote: > Hi, I have a requirement where I have to sort a field which has euc-jp > characters in it. When i sort them we find that Japanese Hiragana > Characters are sorted properly. But Chinese characters are not sorted > properly. Can you define "properly"? What is it you want to sort? > Can any one give some sujestions how to fix it? I have set the > LC_ALL=ja_JP in the profile. Unfortunately with Japanese "Chinese" characters there is no algorithmically determinable sort order You will need some kind of lookup table containing hiragana (and possibly katakana) if you want to sort in phonetic dictionary order as there is a "many to many" relationship between characters / combinations of characters and their pronuncation(s). If the data you are dealing with represents names you don't have a chance unless the data comes with the pronunciation in a seperate field (which is why Japanese forms usually have space for both characters and pronuncation). It should be possible using a lookup table to determine sort order of a given set of characters based on their structure (radical / stroke count), but this method of sorting is archaic and generally not used. Ian Barwick barwick@gmx.net