Received: from cc.kmu.edu.tw (cc.kmu.edu.tw [163.15.154.1]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eA927Fs66689 for ; Wed, 8 Nov 2000 21:07:21 -0500 (EST) (envelope-from cch@cc.kmu.edu.tw) Received: from cc.kmu.edu.tw (c198.cc.kmu.edu.tw [163.15.154.198]) by cc.kmu.edu.tw (8.9.3/8.9.3) with ESMTP id KAA06129 for ; Thu, 9 Nov 2000 10:06:17 +0800 Message-ID: <3A0A07FA.129ED448@cc.kmu.edu.tw> Date: Thu, 09 Nov 2000 10:12:10 +0800 From: Chih-Chang Hsieh Reply-To: cch@cc.kmu.edu.tw Organization: KMU Computer Center X-Mailer: Mozilla 4.73 [zh_TW] (X11; I; FreeBSD 4.1.1-STABLE i386) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-patches@postgresql.org Subject: A Patch for MIC to EUC_TW code converting in mb support Content-Type: multipart/mixed; boundary="------------31A434B82CD9E0D0E21C5C28" X-Archive-Number: 200011/30 X-Sequence-Number: 38 這是 MIME 格式的多片段郵件。 --------------31A434B82CD9E0D0E21C5C28 Content-Type: text/plain; charset=big5 Content-Transfer-Encoding: 7bit ============================================================================ POSTGRESQL BUG REPORT: MIC to EUC_TW code converting in mb support ============================================================================ System Configuration --------------------- Architecture (example: Intel Pentium) :x86 Operating System (example: Linux 2.0.26 ELF) :Linux 2.2.x and FreeBSD 3.5R PostgreSQL version (example: PostgreSQL-7.0) :PostgreSQL-7.0.2 Compiler used (example: gcc 2.8.0) :egcs-2.91.66, gcc 2.7.3 A FULL description of the problem: ------------------------------------------------ In PostgreSQL mb (multi-byte) support, there is a bug in code converting for MIC to EUC_TW. Original mic2euc_tw() in conv.c converts CNS 11643-1992 Plane 2 into 2 bytes EUC_TW encoding. But characters in CNS 11643-1992 Plane 2 should be converted into 4 bytes EUC_TW encoding instead. A way to repeat the problem: ---------------------------------------------------------------------- When you initdb with -E EUC_TW and set PGCLIENTENCODING to BIG5, you will find all the characters in CNS 11643-1992 Plane 2 are incorrectly stored or output. This problem might be fixed by the solution in the attachement. --------------31A434B82CD9E0D0E21C5C28 Content-Type: text/plain; charset=big5; name="mic2euc_tw-patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mic2euc_tw-patch" *** conv.c Wed Nov 8 22:44:21 2000 --- conv.c.orig Sat May 20 21:12:26 2000 *************** *** 906,920 **** { len -= pg_mic_mblen(mic++); ! if (c1 == LC_CNS11643_1) { - *p++ = *mic++; - *p++ = *mic++; - } - else if (c1 == LC_CNS11643_2) - { - *p++ = SS2; - *p++ = 0xa2; *p++ = *mic++; *p++ = *mic++; } --- 906,913 ---- { len -= pg_mic_mblen(mic++); ! if (c1 == LC_CNS11643_1 || c1 == LC_CNS11643_2) { *p++ = *mic++; *p++ = *mic++; } --------------31A434B82CD9E0D0E21C5C28--