Commit 8a35ac24 authored by Tatsuo Ishii's avatar Tatsuo Ishii

Fix bugs in EUC_TW support. This fix includes patches contributed

by Chih-Chang Hsi. See "A Patch for MIC to EUC_TW code converting in
mb support" posting in pgsql-patches list dated 09 Nov 2000.
parent afde2acc
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* WIN1250 client encoding support contributed by Pavel Behal * WIN1250 client encoding support contributed by Pavel Behal
* SJIS UDC (NEC selection IBM kanji) support contributed by Eiji Tokuya * SJIS UDC (NEC selection IBM kanji) support contributed by Eiji Tokuya
* *
* $Id: conv.c,v 1.20 2000/10/30 10:40:28 ishii Exp $ * $Id: conv.c,v 1.21 2000/11/17 04:42:10 ishii Exp $
* *
* *
*/ */
...@@ -538,15 +538,22 @@ mic2euc_tw(unsigned char *mic, unsigned char *p, int len) ...@@ -538,15 +538,22 @@ mic2euc_tw(unsigned char *mic, unsigned char *p, int len)
{ {
len -= pg_mic_mblen(mic++); len -= pg_mic_mblen(mic++);
if (c1 == LC_CNS11643_1 || c1 == LC_CNS11643_2) if (c1 == LC_CNS11643_1)
{ {
*p++ = *mic++; *p++ = *mic++;
*p++ = *mic++; *p++ = *mic++;
} }
else if (c1 == LC_CNS11643_2)
{
*p++ = SS2;
*p++ = 0xa2;
*p++ = *mic++;
*p++ = *mic++;
}
else if (c1 == 0x9d) else if (c1 == 0x9d)
{ /* LCPRV2? */ { /* LCPRV2? */
*p++ = SS2; *p++ = SS2;
*p++ = c1 - LC_CNS11643_3 + 0xa3; *p++ = *mic++ - LC_CNS11643_3 + 0xa3;
*p++ = *mic++; *p++ = *mic++;
*p++ = *mic++; *p++ = *mic++;
} }
...@@ -573,7 +580,7 @@ big52mic(unsigned char *big5, unsigned char *p, int len) ...@@ -573,7 +580,7 @@ big52mic(unsigned char *big5, unsigned char *p, int len)
unsigned short big5buf, unsigned short big5buf,
cnsBuf; cnsBuf;
unsigned char lc; unsigned char lc;
char bogusBuf[2]; char bogusBuf[3];
int i; int i;
while (len > 0 && (c1 = *big5++)) while (len > 0 && (c1 = *big5++))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment