Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 5A016475FBF; Thu, 13 Jun 2002 03:46:49 -0400 (EDT) Received: from mx1.redhat.com (mx1.redhat.com [66.187.233.31]) by postgresql.org (Postfix) with ESMTP id D594E475E42; Thu, 13 Jun 2002 03:46:43 -0400 (EDT) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id g5D7cH917068; Thu, 13 Jun 2002 03:38:17 -0400 Received: from ns.tokyo.redhat.com (IDENT:root@ns.tokyo.redhat.com [172.16.21.254]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id g5D7kd305659; Thu, 13 Jun 2002 03:46:40 -0400 Received: from ybb.ne.jp (station3.tokyo.redhat.com [172.16.21.133]) by ns.tokyo.redhat.com (8.11.6/8.11.6) with ESMTP id g5D7lfE18641; Thu, 13 Jun 2002 16:47:41 +0900 Message-ID: <3D084D76.8040509@ybb.ne.jp> Date: Thu, 13 Jun 2002 16:44:54 +0900 From: Bill Huang Organization: Private mailbox User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2.1) Gecko/20010901 X-Accept-Language: en-us MIME-Version: 1.0 To: Tatsuo Ishii Cc: pgsql-announce@postgresql.org, pgsql-patches@postgresql.org, bhuang@redhat.com, ynakai@redhat.com Subject: Re: Chinese GB18030 support is implemented! References: <3CFF0AE1.10205@ybb.ne.jp> <20020613.153950.50337713.t-ishii@sra.co.jp> Content-Type: multipart/mixed; boundary="------------070607090801030306040901" X-Archive-Number: 200206/57 X-Sequence-Number: 3958 This is a multi-part message in MIME format. --------------070607090801030306040901 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hi Ishii-san, The patches are attached.Please apply it. Thanks, Bill Tatsuo Ishii wrote: >>Hello, >> >>As postgresql is widely used in the world,many Chinese users are looking >>forward to use such a high performanced database management >>system.However since the Chinese new codepage standard GB18030 is not >>completely supported,postgresql is limitted to be used in China. >> >>Now I have managed to implement the GB18030 support upon the latest >>version,so the following functions are added after the patches are added. >> >>-Chinese GB18030 encoding is available on front-end side,while on >>backend side,EUC_CN or MIC is used. >>-Encoding convertion between MIC and GB18030 is implement. >>-GB18030 locale support is available on front-end side. >>-GB18030 locale test is added. >> >>Any help for testing with these patches and sugguestions for GB18030 >>support are greatly appreciated. >> > >We need to apply your pacthes to the current source tree(we are not >allowed to add new feature stable source tree). Your pacthes for >encnames.c pg_wchar.h and wchar.c are rejected due to the difference >between 7.2 and current. > >Can you give me patches encnames.c pg_wchar.h and wchar.c against >current? > >Unicode conversion map staffs ISO10646-GB18030.TXT utf8_to_gb18030.map >UCS_to_GB18030.pl and gb18030_to_utf8.map are looks good for >current. So I will apply them. >-- >Tatsuo Ishii > -- /---------------------------/ (Bill Huang) E-mail:bill_huanghb@ybb.ne.jp Cell phone:090-9979-4631 /---------------------------/ --------------070607090801030306040901 Content-Type: text/plain; name="pgsql.encnames-gb18030.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="pgsql.encnames-gb18030.patch" --- pgsql/src/backend/utils/mb/encnames.c.org Thu Jun 13 16:15:54 2002 +++ pgsql/src/backend/utils/mb/encnames.c Thu Jun 13 16:26:42 2002 @@ -239,6 +239,9 @@ { "windows950", PG_BIG5 }, /* alias for BIG5 */ + { + "gb18030", PG_GB18030 + }, /* GB18030;GB18030 */ { NULL, 0 @@ -353,6 +356,9 @@ }, { "WIN1250", PG_WIN1250 + }, + { + "gb18030", PG_GB18030 } }; --------------070607090801030306040901 Content-Type: text/plain; name="pgsql.pg_wchar-gb18030.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="pgsql.pg_wchar-gb18030.patch" --- pgsql/src/include/mb/pg_wchar.h.org Thu Jun 13 16:39:41 2002 +++ pgsql/src/include/mb/pg_wchar.h Thu Jun 13 16:43:47 2002 @@ -190,6 +190,7 @@ PG_UHC, /* UHC (Windows-949) */ PG_WIN1250, /* windows-1250 */ + PG_GB18030, /* GB18030 */ _PG_LAST_ENCODING_ /* mark only */ } pg_enc; --------------070607090801030306040901 Content-Type: text/plain; name="pgsql.wchar-gb18030.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="pgsql.wchar-gb18030.patch" --- pgsql/src/backend/utils/mb/wchar.c.org Thu Jun 13 16:37:06 2002 +++ pgsql/src/backend/utils/mb/wchar.c Thu Jun 13 16:33:17 2002 @@ -510,6 +510,31 @@ return (len); } +/* + * * GB18030 + * * Added by Bill Huang , + * */ +static int +pg_gb18030_mblen(const unsigned char *s) +{ + int len; + if (*s <= 0x7f) + { /* ASCII */ + len = 1; + } + else + { + if((*(s+1) >= 0x40 && *(s+1) <= 0x7e)|| (*(s+1) >= 0x80 && *(s+1) <= 0xfe)) + len = 2; + else if(*(s+1) >= 0x30 && *(s+1) <= 0x39) + len = 4; + else + len = 2; + } + return (len); +} + + pg_wchar_tbl pg_wchar_table[] = { {pg_ascii2wchar_with_len, pg_ascii_mblen, 1}, /* 0; PG_SQL_ASCII */ {pg_eucjp2wchar_with_len, pg_eucjp_mblen, 3}, /* 1; PG_EUC_JP */ @@ -544,6 +569,7 @@ {0, pg_gbk_mblen, 2}, /* 30; PG_GBK */ {0, pg_uhc_mblen, 2}, /* 31; PG_UHC */ {pg_latin12wchar_with_len, pg_latin1_mblen, 1}, /* 32; PG_WIN1250 */ + {0, pg_gb18030_mblen, 2} /* 33; PG_GB18030 */ }; /* returns the byte length of a word for mule internal code */ --------------070607090801030306040901--