Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8a35ac2

Browse files
committed
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.
1 parent afde2ac commit 8a35ac2

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/backend/utils/mb/conv.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* WIN1250 client encoding support contributed by Pavel Behal
77
* SJIS UDC (NEC selection IBM kanji) support contributed by Eiji Tokuya
88
*
9-
* $Id: conv.c,v 1.20 2000/10/30 10:40:28 ishii Exp $
9+
* $Id: conv.c,v 1.21 2000/11/17 04:42:10 ishii Exp $
1010
*
1111
*
1212
*/
@@ -538,15 +538,22 @@ mic2euc_tw(unsigned char *mic, unsigned char *p, int len)
538538
{
539539
len -= pg_mic_mblen(mic++);
540540

541-
if (c1 == LC_CNS11643_1 || c1 == LC_CNS11643_2)
541+
if (c1 == LC_CNS11643_1)
542542
{
543543
*p++ = *mic++;
544544
*p++ = *mic++;
545545
}
546+
else if (c1 == LC_CNS11643_2)
547+
{
548+
*p++ = SS2;
549+
*p++ = 0xa2;
550+
*p++ = *mic++;
551+
*p++ = *mic++;
552+
}
546553
else if (c1 == 0x9d)
547554
{ /* LCPRV2? */
548555
*p++ = SS2;
549-
*p++ = c1 - LC_CNS11643_3 + 0xa3;
556+
*p++ = *mic++ - LC_CNS11643_3 + 0xa3;
550557
*p++ = *mic++;
551558
*p++ = *mic++;
552559
}
@@ -573,7 +580,7 @@ big52mic(unsigned char *big5, unsigned char *p, int len)
573580
unsigned short big5buf,
574581
cnsBuf;
575582
unsigned char lc;
576-
char bogusBuf[2];
583+
char bogusBuf[3];
577584
int i;
578585

579586
while (len > 0 && (c1 = *big5++))

0 commit comments

Comments
 (0)