summaryrefslogtreecommitdiff
path: root/src/backend/utils/mb/wchar.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1999-02-02 18:51:40 +0000
committerBruce Momjian <bruce@momjian.us>1999-02-02 18:51:40 +0000
commita7ad43cd18ebadf8c3d9cb117ff82ff4077a2986 (patch)
treea8eb845cbea1db7a0a4917063a465f64f272326a /src/backend/utils/mb/wchar.c
parent8358a8f6a0cd5700c1aa60f75023f957e8535c83 (diff)
Included patches make some enhancements to the multi-byte support.
o allow to use Big5 (a Chinese encoding used in Taiwan) as a client encoding. In this case the server side encoding should be EUC_TW o add EUC_TW and Big5 test cases to the regression and the mb test (contributed by Jonah Kuo) o fix mistake in include/mb/pg_wchar.h. An encoding id for EUC_TW was not correct (was 3 and now is 4) o update documents (doc/README.mb and README.mb.jp) o update psql helpfile (bin/psql/psqlHelp.h) -- Tatsuo Ishii t-ishii@sra.co.jp
Diffstat (limited to 'src/backend/utils/mb/wchar.c')
-rw-r--r--src/backend/utils/mb/wchar.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/backend/utils/mb/wchar.c b/src/backend/utils/mb/wchar.c
index edd786f29f8..2a1141fbadb 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.4 1998/09/01 04:33:26 momjian Exp $
+ * $Id: wchar.c,v 1.5 1999/02/02 18:51:23 momjian Exp $
*/
#include "mb/pg_wchar.h"
@@ -396,6 +396,25 @@ pg_sjis_mblen(const unsigned char *s)
return (len);
}
+/*
+ * Big5
+ */
+static int
+pg_big5_mblen(const unsigned char *s)
+{
+ int len;
+
+ if (*s > 0x7f)
+ { /* kanji? */
+ len = 2;
+ }
+ else
+ { /* should be ASCII */
+ len = 1;
+ }
+ return (len);
+}
+
pg_wchar_tbl pg_wchar_table[] = {
{pg_ascii2wchar_with_len, pg_ascii_mblen},
{pg_eucjp2wchar_with_len, pg_eucjp_mblen},
@@ -429,7 +448,8 @@ pg_wchar_tbl pg_wchar_table[] = {
{0, 0},
{0, 0},
{0, 0},
- {0, pg_sjis_mblen}
+ {0, pg_sjis_mblen},
+ {0, pg_big5_mblen}
};
/* returns the byte length of a word for mule internal code */