summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTatsuo Ishii <ishii@postgresql.org>2000-05-28 04:57:06 +0000
committerTatsuo Ishii <ishii@postgresql.org>2000-05-28 04:57:06 +0000
commit67f6b333acc70e7346078dde25fb237465a31271 (patch)
tree8cfbde6331c42e9fb062c0dbe347599df8364864 /src
parent46645b93784780aac81b126a84524cdcdbbe0f1b (diff)
Make EUC_CN support more robust.
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/mb/wchar.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/utils/mb/wchar.c b/src/backend/utils/mb/wchar.c
index bc576a1789b..383ec476f70 100644
--- a/src/backend/utils/mb/wchar.c
+++ b/src/backend/utils/mb/wchar.c
@@ -1,7 +1,7 @@
/*
* conversion functions between pg_wchar and multi-byte streams.
* Tatsuo Ishii
- * $Id: wchar.c,v 1.11 2000/04/12 17:16:06 momjian Exp $
+ * $Id: wchar.c,v 1.11.2.1 2000/05/28 04:57:06 ishii Exp $
*
* WIN1250 client encoding updated by Pavel Behal
*
@@ -166,7 +166,11 @@ pg_euccn_mblen(const unsigned char *s)
{
int len;
- if (*s & 0x80)
+ /* if the first byte > 0x80, then second byte must be > 0x80, also,
+ * according to the EUC-CN standard. But in reality there are
+ * so many broken EUC-CN data violating the rule. Sigh.
+ */
+ if ((*s & 0x80) && (*(s+1) & 0x80))
len = 2;
else
len = 1;