summaryrefslogtreecommitdiff
path: root/src/backend/utils/mb/utftest.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/mb/utftest.c')
-rw-r--r--src/backend/utils/mb/utftest.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/backend/utils/mb/utftest.c b/src/backend/utils/mb/utftest.c
index e6556afe274..5f0f7f9fb7e 100644
--- a/src/backend/utils/mb/utftest.c
+++ b/src/backend/utils/mb/utftest.c
@@ -1,13 +1,11 @@
/*
- * testing of utf2wchar()
- * $Id: utftest.c,v 1.3 1999/07/15 23:03:31 momjian Exp $
+ * $Id: utftest.c,v 1.4 2000/10/12 06:06:50 ishii Exp $
*/
-#include "regex/regex.h"
-#include "regex/utils.h"
-#include "regex/regex2.h"
-
-#include "regex/pg_wchar.h"
+#include "conv.c"
+#include "wchar.c"
+#include "mbutils.c"
+int
main()
{
/* Example 1 from RFC2044 */
@@ -21,11 +19,17 @@ main()
char *utf[] = {utf1, utf2, utf3};
pg_wchar ucs[128];
pg_wchar *p;
+ unsigned char iso[1024];
int i;
+ /* UTF8-->ISO8859-2 test */
+ unsigned char utf_iso8859_2[] = {0x01, 0x00, 0x01, 0x02, 0x01, 0x55, 0x02, 0xdd, 0x00};
+
+ printf("===== testing of pg_utf2wchar_with_len =====\n");
+
for (i = 0; i < sizeof(utf) / sizeof(char *); i++)
{
- pg_utf2wchar(utf[i], ucs);
+ pg_utf2wchar_with_len(utf[i], ucs, 128);
p = ucs;
while (*p)
{
@@ -34,4 +38,16 @@ main()
}
printf("\n");
}
+
+ printf("===== testing of utf_to_latin2 =====\n");
+ utf_to_latin(utf_iso8859_2, iso, LATIN2, 128);
+ for (i = 0; i < sizeof(iso) / sizeof(char *); i++)
+ {
+ printf("%04x ", iso[i]);
+ if (iso[i] == 0x00)
+ break;
+ }
+ printf("\n");
+
+ return(0);
}