Skip to content

Commit 976a456

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 1350059 commit 976a456

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.15 2000/05/20 13:12:26 ishii Exp $
9+
* $Id: conv.c,v 1.15.2.1 2000/11/17 04:53:54 ishii Exp $
1010
*
1111
*
1212
*/
@@ -906,15 +906,22 @@ mic2euc_tw(unsigned char *mic, unsigned char *p, int len)
906906
{
907907
len -= pg_mic_mblen(mic++);
908908

909-
if (c1 == LC_CNS11643_1 || c1 == LC_CNS11643_2)
909+
if (c1 == LC_CNS11643_1)
910910
{
911911
*p++ = *mic++;
912912
*p++ = *mic++;
913913
}
914+
else if (c1 == LC_CNS11643_2)
915+
{
916+
*p++ = SS2;
917+
*p++ = 0xa2;
918+
*p++ = *mic++;
919+
*p++ = *mic++;
920+
}
914921
else if (c1 == 0x9d)
915922
{ /* LCPRV2? */
916923
*p++ = SS2;
917-
*p++ = c1 - LC_CNS11643_3 + 0xa3;
924+
*p++ = *mic++ - LC_CNS11643_3 + 0xa3;
918925
*p++ = *mic++;
919926
*p++ = *mic++;
920927
}
@@ -941,7 +948,7 @@ big52mic(unsigned char *big5, unsigned char *p, int len)
941948
unsigned short big5buf,
942949
cnsBuf;
943950
unsigned char lc;
944-
char bogusBuf[2];
951+
char bogusBuf[3];
945952
int i;
946953

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy