1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-15 19:21:59 +03:00

Fix long standing Asian multibyte charsets bug.

See:

Subject: [HACKERS] bugs with certain Asian multibyte charsets
From: Tatsuo Ishii <ishii@sraoss.co.jp>
To: pgsql-hackers@postgresql.org
Date: Sat, 24 Dec 2005 18:25:33 +0900 (JST)

for more details.
This commit is contained in:
Tatsuo Ishii
2005-12-24 12:08:10 +00:00
parent cd726e1cf8
commit 951f2bdd23

View File

@ -1,7 +1,7 @@
/* /*
* conversion functions between pg_wchar and multibyte streams. * conversion functions between pg_wchar and multibyte streams.
* Tatsuo Ishii * Tatsuo Ishii
* $Id: wchar.c,v 1.30.2.1 2003/01/11 06:59:30 ishii Exp $ * $Id: wchar.c,v 1.30.2.2 2005/12/24 12:08:10 ishii Exp $
* *
* WIN1250 client encoding updated by Pavel Behal * WIN1250 client encoding updated by Pavel Behal
* *
@ -70,7 +70,7 @@ static int pg_euc2wchar_with_len
{ {
from++; from++;
*to = *from++ << 8; *to = *from++ << 8;
*to |= 0x3f & *from++; *to |= 0x7f & *from++;
len -= 3; len -= 3;
} }
else if ((*from & 0x80) && len >= 2) else if ((*from & 0x80) && len >= 2)
@ -150,7 +150,7 @@ static int pg_euccn2wchar_with_len
if (*from == SS2 && len >= 3) if (*from == SS2 && len >= 3)
{ {
from++; from++;
*to = 0x3f00 & (*from++ << 8); *to = 0x7f00 & (*from++ << 8);
*to = *from++; *to = *from++;
len -= 3; len -= 3;
} }
@ -158,7 +158,7 @@ static int pg_euccn2wchar_with_len
{ {
from++; from++;
*to = *from++ << 8; *to = *from++ << 8;
*to |= 0x3f & *from++; *to |= 0x7f & *from++;
len -= 3; len -= 3;
} }
else if ((*from & 0x80) && len >= 2) else if ((*from & 0x80) && len >= 2)
@ -213,7 +213,7 @@ static int pg_euctw2wchar_with_len
{ {
from++; from++;
*to = *from++ << 8; *to = *from++ << 8;
*to |= 0x3f & *from++; *to |= 0x7f & *from++;
len -= 3; len -= 3;
} }
else if ((*from & 0x80) && len >= 2) else if ((*from & 0x80) && len >= 2)