summaryrefslogtreecommitdiff
path: root/src/backend/utils/mb/conv.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1998-08-24 01:14:24 +0000
committerBruce Momjian <bruce@momjian.us>1998-08-24 01:14:24 +0000
commitc0b01461db59a472f5817a8c6e99091b8a48ffc5 (patch)
tree8ea77fde00c4a8da22920d9d0aa7f8b8a77e67e0 /src/backend/utils/mb/conv.c
parent9438fe5d091162136e96991da391a559e078aa23 (diff)
downloadpostgresql-c0b01461db59a472f5817a8c6e99091b8a48ffc5.tar.gz
o note that now pg_database has a new attribuite "encoding" even
if MULTIBYTE is not enabled. So be sure to run initdb. o these patches are made against the latest source tree (after Bruce's massive patch, I think) BTW, I noticed that after running regression, the oid field of pg_type seems disappeared. regression=> select oid from pg_type; ERROR: attribute 'oid' not found this happens after the constraints test. This occures with/without my patches. strange... o pg_database_mb.h, pg_class_mb.h, pg_attribute_mb.h are no longer used, and shoud be removed. o GetDatabaseInfo() in utils/misc/database.c removed (actually in #ifdef 0). seems nobody uses. t-ishii@sra.co.jp
Diffstat (limited to 'src/backend/utils/mb/conv.c')
-rw-r--r--src/backend/utils/mb/conv.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/backend/utils/mb/conv.c b/src/backend/utils/mb/conv.c
index bca95c5f6b..01c92e3b9a 100644
--- a/src/backend/utils/mb/conv.c
+++ b/src/backend/utils/mb/conv.c
@@ -2,7 +2,7 @@
* conversion between client encoding and server internal encoding
* (currently mule internal code (mic) is used)
* Tatsuo Ishii
- * $Id: conv.c,v 1.1 1998/07/24 03:31:56 scrappy Exp $
+ * $Id: conv.c,v 1.2 1998/08/24 01:13:59 momjian Exp $
*/
#include <stdio.h>
#include <string.h>
@@ -369,7 +369,38 @@ static void mic2latin5(unsigned char *mic, unsigned char *p, int len)
mic2latin(mic, p, len, LC_ISO8859_5);
}
+/*
+ * ASCII ---> MIC
+ */
+static void ascii2mic(unsigned char *l, unsigned char *p, int len)
+{
+ int c1;
+
+ while (len-- > 0 && (c1 = *l++)) {
+ *p++ = (c1 & 0x7f);
+ }
+ *p = '\0';
+}
+
+/*
+ * MIC ---> ASCII
+ */
+static void mic2ascii(unsigned char *mic, unsigned char *p, int len)
+{
+ int c1;
+
+ while (len > 0 && (c1 = *mic)) {
+ if (c1 > 0x7f) {
+ printBogusChar(&mic, &p);
+ } else { /* should be ASCII */
+ *p++ = c1;
+ }
+ }
+ *p = '\0';
+}
+
pg_encoding_conv_tbl pg_conv_tbl[] = {
+ {SQL_ASCII, "SQL_ASCII", 0, ascii2mic, mic2ascii}, /* SQL/ACII */
{EUC_JP, "EUC_JP", 0, euc_jp2mic, mic2euc_jp}, /* EUC_JP */
{EUC_CN, "EUC_CN", 0, euc_cn2mic, mic2euc_cn}, /* EUC_CN */
{EUC_KR, "EUC_KR", 0, euc_kr2mic, mic2euc_kr}, /* EUC_KR */