--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/Makefile Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,38 @@
+#
+# This Makefile simply build 32-bit binaries. If you wish to use *.csh
+# test suite execution shell script files, you will have to modify
+# this Makefile to build 32-bit and 64-bit executables with -sparc, -sparcv9,
+# -i386, and -amd64 appended at their names. Please see *.csh files for
+# some more hints.
+#
+CCCSRCS = conversion-test1.c \
+ conversion-test2.c \
+ conversion-test3.c \
+ conversion-test-cn.c \
+ conversion-test-jp-2.c \
+ conversion-test-jp-3.c \
+ conversion-test-jp.c \
+ conversion-test-kr.c \
+ ucnv_getDefaultName.c \
+ ucnv_getMaxCharSize.c
+CCSRCS = ucnv_toUChars.c \
+ ucnv_createConverter.c
+
+TGCC = $(CCSRCS:%.c=%)
+TGCCC = $(CCCSRCS:%.c=%)
+
+all:
+ for f in $(TGCC) ; do \
+ echo $$f ; \
+ cc -o $$f-32 $$f.c -licui18n -licudata -licuuc ; \
+ cc -m64 -o $$f-64 $$f.c -licui18n -licudata -licuuc ; \
+ done
+ for f in $(TGCCC) ; do \
+ echo $$f ; \
+ CC -o $$f-32 $$f.c -licui18n -licudata -licuuc ; \
+ CC -m64 -o $$f-64 $$f.c -licui18n -licudata -licuuc ; \
+ done
+ @echo "ICU test case build done."
+
+clean:
+ /bin/rm -f $(TGCC) $(TGCCC)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/README Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,6 @@
+The tests expect developer/icu and library/icu to be installed.
+Make sure you have Oracle Studio in your path and build the tests by issuing
+gmake
+Launch the tests by issuing
+csh runall.csh
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/UTF-8-converted-from-x-windows-949.txt Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,3 @@
+2001년 8월1일부터 '개인승용차 보험료의 완전자유화'
+되면서 같은 조건에서도 보험사별로 자 동차보험료에 상당한 차이를 보이고
+있습니다.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/conversion-test-cn.c Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,101 @@
+// Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <unicode/utypes.h>
+#include <unicode/ucnv.h>
+#include <unicode/unistr.h>
+#include <unicode/translit.h>
+
+main()
+{
+ UBool ret = TRUE;
+ UConverter *convfrom = 0;
+ UConverter *convto = 0;
+ UErrorCode err = U_ZERO_ERROR;
+ UBool flush;
+ const char *cbufp;
+ char *bufp;
+ char *buf = 0;
+ int i;
+ int32_t len32;
+
+ const UChar *unibufbp;
+ UChar *unibufp;
+ UChar *unibuf = 0;
+
+ printf("Conversion testing for ISO-2022-CN:\n\n");
+ convto = ucnv_open("iso-2022-cn", &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "ucnv_open error - exiting.\n");
+ exit(-1);
+ }
+ buf = (char *)malloc(1024);
+ memset(buf, 0, 1024);
+ unibuf = (UChar *)malloc(sizeof(UChar) * 4);
+ unibuf[0] = 0x611f;
+ unibuf[1] = 0x000d;
+ unibuf[2] = 0x000a;
+ unibuf[3] = 0x611f;
+
+ bufp = buf;
+ unibufp = unibuf;
+
+ printf("Checking ucnv_fromUnicode()...\n");
+ ucnv_fromUnicode(convto, &bufp, (const char *)bufp + 1024,
+ (const UChar **)&unibufp,
+ (const UChar *)unibuf + 4,
+ NULL, (1 > 0), &err);
+ bufp += 15;
+ unibufp = unibuf + 4;
+ ucnv_fromUnicode(convto, &bufp, (const char *)bufp + 1024 - 15,
+ (const UChar **)&unibufp,
+ (const UChar *)unibufp,
+ NULL, (1 > 0), &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "conversion error!\n");
+ exit(-1);
+ }
+
+ for (i = 0; buf[i]; i++)
+ if (buf[i] == 0x1b)
+ printf("%3d %02x ESC\n", i, (unsigned char)buf[i]);
+ else
+ printf("%3d %02x\n", i, (unsigned char)buf[i]);
+ if (i > 0 && buf[i - 1] == 0x0f)
+ printf("Conversion ended with SI - success.\n\n");
+ else
+ printf("Conversion didn't end with SI - failed.\n\n");
+
+
+ ucnv_resetFromUnicode(convto);
+
+ memset(buf, 0, 1024);
+ unibuf[0] = 0x611f;
+ unibuf[1] = 0x000d;
+ unibuf[2] = 0x000a;
+ unibuf[3] = 0x611f;
+
+ bufp = buf;
+ unibufp = unibuf;
+ printf("Checking ucnv_fromUChars()...\n");
+ len32 = ucnv_fromUChars(convto, bufp, 1024, unibufp, 4, &err);
+ for (i = 0; len32 > i; i++)
+ if (buf[i] == 0x1b)
+ printf("%3d %02x ESC\n", i, (unsigned char)buf[i]);
+ else
+ printf("%3d %02x\n", i, (unsigned char)buf[i]);
+
+
+ if (i > 0 && buf[i - 1] == 0x0f)
+ printf("Conversion ended with SI - success.\n");
+ else
+ printf("Conversion didn't end with SI - failed.\n");
+
+ if (convto) ucnv_close(convto);
+
+ if (buf) delete[] buf;
+ if (unibuf) delete[] unibuf;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/conversion-test-jp-2.c Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,79 @@
+// Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <unicode/utypes.h>
+#include <unicode/ucnv.h>
+#include <unicode/unistr.h>
+#include <unicode/translit.h>
+
+main()
+{
+ UBool ret = TRUE;
+ UConverter *convfrom = 0;
+ UConverter *convto = 0;
+ UErrorCode err = U_ZERO_ERROR;
+ UBool flush;
+ const char *cbufp;
+ char *bufp;
+ char *buf = 0;
+ int i;
+ int32_t len32;
+
+ const UChar *unibufbp;
+ UChar *unibufp;
+ UChar *unibuf = 0;
+ UChar *saveunibuf;
+
+ printf("Conversion test for ISO-2022-JP's JIS X 0201 C0 characters:\n\n");
+ convto = ucnv_open("iso-2022-jp", &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "ucnv_open error - exiting.\n");
+ exit(-1);
+ }
+ buf = (char *)malloc(1024);
+ memset(buf, 0, 1024);
+
+ /* ESC $ B ?? ESC ( J A \n for JIS X 0201
+ */
+ strcpy(buf, "\x1b\x24\x42\x4a\x52\x1b\x28\x4a\x41\x0a");
+
+ /* ESC $ B ?? ESC ( J \n for JIS X 0201
+ strcpy(buf, "\x1b\x24\x42\x4a\x52\x1b\x28\x4a\x0a");
+ */
+
+ /* ESC $ B ?? ESC ( B \n for ASCII
+ strcpy(buf, "\x1b\x24\x42\x4a\x52\x1b\x28\x42\x0a");
+ */
+
+ saveunibuf = unibuf = (UChar *)malloc(sizeof(UChar) * 100);
+ memset(unibuf, 0, sizeof(UChar) * 100);
+
+ bufp = buf;
+ unibufp = unibuf;
+
+ printf("Converting by using ucnv_toUnicode()...\n");
+ ucnv_toUnicode(convto, &unibufp, (const UChar *)(unibuf + 100),
+ (const char **)&bufp, (const char *)(bufp + strlen(buf)), NULL,
+ TRUE, &err);
+
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "conversion error!\n");
+ exit(-1);
+ }
+
+ for (i = 0; unibuf < unibufp; unibuf++)
+ printf("%3d U+%04X\n", i++, *unibuf);
+
+ if (i > 2 && *(unibuf - 3) == 0x7247 && *(unibuf - 2) == 0x41 &&
+ *(unibuf - 1) == 0xa)
+ printf("Conversion done correctly - success.\n");
+ else
+ printf("Conversion done incorrectly - failed.\n");
+ if (convto) ucnv_close(convto);
+
+ if (buf) delete[] buf;
+ if (saveunibuf) delete[] saveunibuf;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/conversion-test-jp-3.c Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,96 @@
+// Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <unicode/utypes.h>
+#include <unicode/ucnv.h>
+#include <unicode/unistr.h>
+#include <unicode/translit.h>
+
+main()
+{
+ UBool ret = TRUE;
+ UConverter *convfrom = 0;
+ UConverter *convto = 0;
+ UErrorCode err = U_ZERO_ERROR;
+ UBool flush;
+ const char *cbufp;
+ char *bufp;
+ char *buf = 0;
+ int i, not_okay;
+
+ const UChar *unibufbp;
+ UChar *unibufp;
+ UChar *unibuf = 0;
+ UChar *saveunibuf;
+ UChar targetunibuf[18];
+
+ printf("Conversion test for empty single-byte-segment in ISO-2022-JP:\n\n");
+ convto = ucnv_open("iso-2022-jp", &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "ucnv_open error - exiting.\n");
+ exit(-1);
+ }
+ buf = (char *)malloc(1024);
+ memset(buf, 0, 1024);
+
+ /* ISO-2022-JP string with empty single-byte-segment. See 4987315. */
+ strcpy(buf, "$BJ#?t$N<u<h?M$O%3(B$B%s%^$G6h@Z$j$^$9!#(B");
+
+ /* Seventeen Unicode characters if convert from the above. */
+ targetunibuf[0] = 0x8907;
+ targetunibuf[1] = 0x6570;
+ targetunibuf[2] = 0x306e;
+ targetunibuf[3] = 0x53d7;
+ targetunibuf[4] = 0x53d6;
+ targetunibuf[5] = 0x4eba;
+ targetunibuf[6] = 0x306f;
+ targetunibuf[7] = 0x30b3;
+ targetunibuf[8] = 0x30f3;
+ targetunibuf[9] = 0x30de;
+ targetunibuf[10] = 0x3067;
+ targetunibuf[11] = 0x533a;
+ targetunibuf[12] = 0x5207;
+ targetunibuf[13] = 0x308a;
+ targetunibuf[14] = 0x307e;
+ targetunibuf[15] = 0x3059;
+ targetunibuf[16] = 0x3002;
+ targetunibuf[17] = 0;
+
+ saveunibuf = unibuf = (UChar *)malloc(sizeof(UChar) * 100);
+ memset(unibuf, 0, sizeof(UChar) * 100);
+
+ bufp = buf;
+ unibufp = unibuf;
+
+ printf("Converting by using ucnv_toUnicode()...\n");
+ ucnv_toUnicode(convto, &unibufp, (const UChar *)(unibuf + 100),
+ (const char **)&bufp, (const char *)(bufp + strlen(buf)), NULL,
+ TRUE, &err);
+
+ for (i = not_okay = 0; unibuf < unibufp; unibuf++, i++) {
+ if (i < 17 && *unibuf != targetunibuf[i]) {
+ printf("%3d U+%04X INCORRECT - expected U+%04X\n", i,
+ *unibuf, targetunibuf[i]);
+ not_okay = 1;
+ } else
+ printf("%3d U+%04X\n", i, *unibuf);
+ }
+
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "conversion error!\n");
+ exit(-1);
+ }
+
+ if (not_okay || i > 17)
+ printf("Conversion done incorrectly - failed.\n");
+ else
+ printf("Conversion done correctly - success.\n");
+
+ if (convto) ucnv_close(convto);
+
+ if (buf) delete[] buf;
+ if (saveunibuf) delete[] saveunibuf;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/conversion-test-jp.c Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,103 @@
+// Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <unicode/utypes.h>
+#include <unicode/ucnv.h>
+#include <unicode/unistr.h>
+#include <unicode/translit.h>
+
+main()
+{
+ UBool ret = TRUE;
+ UConverter *convfrom = 0;
+ UConverter *convto = 0;
+ UErrorCode err = U_ZERO_ERROR;
+ UBool flush;
+ const char *cbufp;
+ char *bufp;
+ char *buf = 0;
+ int i;
+ int32_t len32;
+
+ const UChar *unibufbp;
+ UChar *unibufp;
+ UChar *unibuf = 0;
+
+ printf("Conversion testing for ISO-2022-JP:\n\n");
+ convto = ucnv_open("iso-2022-jp", &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "ucnv_open error - exiting.\n");
+ exit(-1);
+ }
+ buf = (char *)malloc(1024);
+ memset(buf, 0, 1024);
+ unibuf = (UChar *)malloc(sizeof(UChar) * 4);
+ unibuf[0] = 0x611f;
+ unibuf[1] = 0x000d;
+ unibuf[2] = 0x000a;
+ unibuf[3] = 0x611f;
+
+ bufp = buf;
+ unibufp = unibuf;
+
+ printf("Checking ucnv_fromUnicode()...\n");
+ ucnv_fromUnicode(convto, &bufp, (const char *)bufp + 1024,
+ (const UChar **)&unibufp,
+ (const UChar *)unibuf + 4,
+ NULL, (1 > 0), &err);
+ bufp += 15;
+ unibufp = unibuf + 4;
+ ucnv_fromUnicode(convto, &bufp, (const char *)bufp + 1024 - 15,
+ (const UChar **)&unibufp,
+ (const UChar *)unibufp,
+ NULL, (1 > 0), &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "conversion error!\n");
+ exit(-1);
+ }
+
+ for (i = 0; buf[i]; i++)
+ if (buf[i] == 0x1b)
+ printf("%3d %02x ESC\n", i, (unsigned char)buf[i]);
+ else
+ printf("%3d %02x\n", i, (unsigned char)buf[i]);
+
+ if (i > 2 && buf[i - 3] == '\x1b' && buf[i - 2] == '(' &&
+ (buf[i - 1] == 'J' || buf[i - 1] == 'B'))
+ printf("Conversion ended with ESC ( J or ESC ( B - success.\n");
+ else
+ printf("Conversion didn't end with ESC ( J or ESC ( B - failed.\n");
+
+
+ ucnv_resetFromUnicode(convto);
+
+ memset(buf, 0, 1024);
+ unibuf[0] = 0x611f;
+ unibuf[1] = 0x000d;
+ unibuf[2] = 0x000a;
+ unibuf[3] = 0x611f;
+
+ bufp = buf;
+ unibufp = unibuf;
+ printf("\nChecking ucnv_fromUChars()...\n");
+ len32 = ucnv_fromUChars(convto, bufp, 1024, unibufp, 4, &err);
+ for (i = 0; len32 > i; i++)
+ if (buf[i] == 0x1b)
+ printf("%3d %02x ESC\n", i, (unsigned char)buf[i]);
+ else
+ printf("%3d %02x\n", i, (unsigned char)buf[i]);
+
+ if (i > 2 && buf[i - 3] == '\x1b' && buf[i - 2] == '(' &&
+ (buf[i - 1] == 'J' || buf[i - 1] == 'B'))
+ printf("Conversion ended with ESC ( J or ESC ( B - success.\n");
+ else
+ printf("Conversion didn't end with ESC ( J or ESC ( B - failed.\n");
+
+ if (convto) ucnv_close(convto);
+
+ if (buf) delete[] buf;
+ if (unibuf) delete[] unibuf;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/conversion-test-kr.c Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,100 @@
+// Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <unicode/utypes.h>
+#include <unicode/ucnv.h>
+#include <unicode/unistr.h>
+#include <unicode/translit.h>
+
+main()
+{
+ UBool ret = TRUE;
+ UConverter *convfrom = 0;
+ UConverter *convto = 0;
+ UErrorCode err = U_ZERO_ERROR;
+ UBool flush;
+ const char *cbufp;
+ char *bufp;
+ char *buf = 0;
+ int i;
+ int32_t len32;
+
+ const UChar *unibufbp;
+ UChar *unibufp;
+ UChar *unibuf = 0;
+
+ printf("Conversion testing for ISO-2022-KR:\n\n");
+ convto = ucnv_open("iso-2022-kr", &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "ucnv_open error - exiting.\n");
+ exit(-1);
+ }
+ buf = (char *)malloc(1024);
+ memset(buf, 0, 1024);
+ unibuf = (UChar *)malloc(sizeof(UChar) * 4);
+ unibuf[0] = 0xac00;
+ unibuf[1] = 0x000d;
+ unibuf[2] = 0x000a;
+ unibuf[3] = 0xac00;
+
+ bufp = buf;
+ unibufp = unibuf;
+
+ printf("Checking ucnv_fromUnicode()...\n");
+ ucnv_fromUnicode(convto, &bufp, (const char *)bufp + 1024,
+ (const UChar **)&unibufp,
+ (const UChar *)unibuf + 4,
+ NULL, (1 > 0), &err);
+ bufp += 15;
+ unibufp = unibuf + 4;
+ ucnv_fromUnicode(convto, &bufp, (const char *)bufp + 1024 - 15,
+ (const UChar **)&unibufp,
+ (const UChar *)unibufp,
+ NULL, (1 > 0), &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "conversion error!\n");
+ exit(-1);
+ }
+
+ for (i = 0; buf[i]; i++)
+ if (buf[i] == 0x1b)
+ printf("%3d %02x ESC\n", i, (unsigned char)buf[i]);
+ else
+ printf("%3d %02x\n", i, (unsigned char)buf[i]);
+
+ if (i > 0 && buf[i - 1] == 0x0f)
+ printf("Conversion ended with SI - success.\n");
+ else
+ printf("Conversion didn't ended with SI - failed.\n");
+
+ ucnv_resetFromUnicode(convto);
+
+ memset(buf, 0, 1024);
+ unibuf[0] = 0xac00;
+ unibuf[1] = 0x000d;
+ unibuf[2] = 0x000a;
+ unibuf[3] = 0xac00;
+
+ bufp = buf;
+ unibufp = unibuf;
+ printf("\nChecking ucnv_fromUChars()...\n");
+ len32 = ucnv_fromUChars(convto, bufp, 1024, unibufp, 4, &err);
+ for (i = 0; len32 > i; i++)
+ if (buf[i] == 0x1b)
+ printf("%3d %02x ESC\n", i, (unsigned char)buf[i]);
+ else
+ printf("%3d %02x\n", i, (unsigned char)buf[i]);
+
+ if (i > 0 && buf[i - 1] == 0x0f)
+ printf("Conversion ended with SI - success.\n");
+ else
+ printf("Conversion didn't ended with SI - failed.\n");
+
+ if (convto) ucnv_close(convto);
+
+ if (buf) delete[] buf;
+ if (unibuf) delete[] unibuf;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/conversion-test.csh Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,41 @@
+#!/bin/csh -f
+#
+# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+
+set path=( $path /usr/bin /usr/sbin /bin )
+
+set UCONV=uconv
+
+set CONVS="1252 CN-Big5 cns11643_1 cp949c Cp949c csUnicode11 csUnicode11UTF7 csUnicodeASCII csUnicodeLatin1 csWindows31Latin5 IMAP-MODIFIED-UTF-7 IMAP_UTF_7 IMAP-UTF-7 ISO-10646 ISO-10646-J-1 ISO-10646-UCS-BASIC ISO-10646-Unicode-Latin1 iso-8859-11 iso_8859-1:1978 ISO-8859-1-Windows-3.0-Latin-1 ISO-8859-1-Windows-3.1-Latin-1 ISO-8859-2-Windows-Latin-2 iso-8859-5-windows-latin-5 ISO-8859-8-Visual MODIFIED_UTF_7 MODIFIED-UTF-7 MUTF_7 MUTF-7 UNICODE-1-1-URF-7 UNICODE-1-1-UTF-7 UNICODE-1-1-UTF-8 unicode-2-0-utf-8 visual x-cp1250 x-cp1251 x-cp1252 x-cp1253 x-cp1254 x-cp1255 x-cp1256 x-cp1257 x-cp1258 x-euc x-ms-cp932 x-x-big5 x-gbk iso-8859-8i Win1255 Big5-HKSCS EUC-TW 5601 ansi-1251 TIS620.2533 x-johab johap x-johap x-euc-tw x-windows-949 iso-8859-13"
+
+set LOGFILE=conversion-test-SunOS.log
+set TMPFILE=tmpfile$$.txt
+
+
+/bin/rm -fr $LOGFILE
+
+@ okay = 1
+foreach i ( $CONVS )
+ echo "Testing $i conversion:" |& tee -a $LOGFILE
+ $UCONV -f us-ascii -t $i /etc/passwd | $UCONV -f $i -t us-ascii >! $TMPFILE
+ diff -c /etc/passwd $TMPFILE >> /dev/null
+ if ( $status == 1) then
+ echo " roundtrip conversion failed..." |& tee -a $LOGFILE
+ @ okay = 0
+ else
+ echo " roundtrip conversion successful." |& tee -a $LOGFILE
+ endif
+end
+
+/bin/rm -fr $TMPFILE
+
+if ( $okay == 0 ) then
+ printf "\nWarning: conversion error happened. Check the log file.\n"
+ echo "Conversion test done; test log has been created as ./${LOGFILE}."
+ exit 1
+endif
+
+echo "Conversion test done; test log has been created as ./${LOGFILE}."
+
+exit 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/conversion-test1.c Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,83 @@
+// Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <unicode/utypes.h>
+#include <unicode/ucnv.h>
+#include <unicode/unistr.h>
+#include <unicode/translit.h>
+
+main(int ac, char **av)
+{
+ UBool ret = TRUE;
+ UConverter *convfrom = 0;
+ UConverter *convto = 0;
+ UErrorCode err = U_ZERO_ERROR;
+ UBool flush;
+ const char *cbufp;
+ char *bufp;
+ char *buf = 0;
+ int i;
+ int32_t len32;
+
+ if (ac != 2) {
+ fprintf(stderr, "Usage: %s [ iso-2022-jp | jis7 | iso-2022-jp-2 ]\n");
+ exit(-1);
+ }
+
+ const UChar *unibufbp;
+ UChar *unibufp;
+ UChar *unibuf = 0;
+ UChar *saveunibuf;
+
+ printf("Conversion test for %s:\n\n", av[1]);
+ convto = ucnv_open(av[1], &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "ucnv_open error - exiting.\n");
+ exit(-1);
+ }
+ buf = (char *)malloc(1024);
+ memset(buf, 0, 1024);
+
+ /* ESC $ ( D ?? ESC ( I ? ESC ( B for JIS X 0212 and JIS X 0201 Kana
+ */
+ strcpy(buf, "\x1b\x24\x28\x44\x30\x21\x1b\x28\x49\x31\x1b\x28\x42");
+
+ /* ESC $ B ?? ESC ( J A \n for JIS X 0201
+ strcpy(buf, "\x1b\x24\x42\x4a\x52\x1b\x28\x4a\x41\x0a");
+ */
+
+ /* ESC $ B ?? ESC ( J \n for JIS X 0201
+ strcpy(buf, "\x1b\x24\x42\x4a\x52\x1b\x28\x4a\x0a");
+ */
+
+ /* ESC $ B ?? ESC ( B \n for ASCII
+ strcpy(buf, "\x1b\x24\x42\x4a\x52\x1b\x28\x42\x0a");
+ */
+
+ saveunibuf = unibuf = (UChar *)malloc(sizeof(UChar) * 100);
+ memset(unibuf, 0, sizeof(UChar) * 100);
+
+ bufp = buf;
+ unibufp = unibuf;
+
+ printf("Converting by using ucnv_toUnicode()...\n");
+ ucnv_toUnicode(convto, &unibufp, (const UChar *)(unibuf + 100),
+ (const char **)&bufp, (const char *)(bufp + strlen(buf)), NULL,
+ TRUE, &err);
+
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "conversion error!\n");
+ exit(-1);
+ }
+
+ for (i = 0; unibuf < unibufp; unibuf++)
+ printf("%3d U+%04X\n", i++, *unibuf);
+
+ if (convto) ucnv_close(convto);
+
+ if (buf) delete[] buf;
+ if (saveunibuf) delete[] saveunibuf;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/conversion-test2.c Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,78 @@
+// Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <unicode/utypes.h>
+#include <unicode/ucnv.h>
+#include <unicode/unistr.h>
+#include <unicode/translit.h>
+
+int main(int ac, char **av)
+{
+ UBool ret = TRUE;
+ UConverter *convfrom = 0;
+ UConverter *convto = 0;
+ UErrorCode err = U_ZERO_ERROR;
+ UBool flush;
+ const char *cbufp;
+ char *bufp;
+ char *buf = 0;
+ int i;
+ int32_t len32;
+
+ const UChar *unibufbp;
+ UChar *unibufp;
+ UChar *unibuf = 0;
+
+ if (ac != 2) {
+ fprintf(stderr, "Usage: %s [jis7 | iso-2022-jp | iso-2022-jp-2 ]\n", av[0]);
+ exit(-1);
+ }
+
+ printf("Conversion testing for %s:\n\n", av[1]);
+ convto = ucnv_open(av[1], &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "ucnv_open error - exiting.\n");
+ exit(-1);
+ }
+ buf = (char *)malloc(1024);
+ memset(buf, 0, 1024);
+ unibuf = (UChar *)malloc(sizeof(UChar) * 4);
+ unibuf[0] = 0x4e02;
+ unibuf[1] = 0x0041;
+ unibuf[2] = 0xff71;
+
+ bufp = buf;
+ unibufp = unibuf;
+
+ printf("Checking ucnv_fromUnicode()...\n");
+ err = U_ZERO_ERROR;
+ ucnv_fromUnicode(convto, &bufp, (const char *)bufp + 1024,
+ (const UChar **)&unibufp,
+ (const UChar *)unibuf + 3,
+ NULL, (1 > 0), &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "conversion error!\n");
+ exit(-1);
+ }
+
+ for (i = 0; buf[i]; i++)
+ if (buf[i] == 0x1b)
+ printf("%3d %02x ESC\n", i, (unsigned char)buf[i]);
+ else
+ printf("%3d %02x %c\n", i, (unsigned char)buf[i], (unsigned char)buf[i]);
+
+ if (i > 2 && buf[i - 3] == '\x1b' && buf[i - 2] == '(' &&
+ (buf[i - 1] == 'J' || buf[i - 1] == 'B'))
+ printf("Conversion ended with ESC ( J or ESC ( B - success.\n");
+ else
+ printf("Conversion didn't end with ESC ( J or ESC ( B - failed.\n");
+
+
+ if (convto) ucnv_close(convto);
+
+ if (buf) delete[] buf;
+ if (unibuf) delete[] unibuf;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/conversion-test3.c Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,83 @@
+// Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <unicode/utypes.h>
+#include <unicode/ucnv.h>
+#include <unicode/unistr.h>
+#include <unicode/translit.h>
+
+int main(int ac, char **av)
+{
+ UBool ret = TRUE;
+ UConverter *convfrom = 0;
+ UConverter *convto = 0;
+ UErrorCode err = U_ZERO_ERROR;
+ UBool flush;
+ const char *cbufp;
+ char *bufp;
+ char *buf = 0;
+ int i;
+ int32_t len32;
+
+ const UChar *unibufbp;
+ UChar *unibufp;
+ UChar *unibuf = 0;
+
+ if (ac != 2) {
+ fprintf(stderr, "Usage: %s [jis7 | iso-2022-jp | iso-2022-jp-2 ]\n", av[0]);
+ exit(-1);
+ }
+
+ printf("Conversion testing for %s:\n\n", av[1]);
+ convto = ucnv_open(av[1], &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "ucnv_open error - exiting.\n");
+ exit(-1);
+ }
+ buf = (char *)malloc(1024);
+ memset(buf, 0, 1024);
+ unibuf = (UChar *)malloc(sizeof(UChar) * 4);
+ unibuf[0] = 0x3002;
+ unibuf[1] = 0xff71;
+ unibuf[2] = 0x3002;
+ /*
+ unibuf[0] = 0x4e02;
+ unibuf[1] = 0x0041;
+ unibuf[2] = 0xff71;
+ */
+
+ bufp = buf;
+ unibufp = unibuf;
+
+ printf("Checking ucnv_fromUnicode()...\n");
+ err = U_ZERO_ERROR;
+ ucnv_fromUnicode(convto, &bufp, (const char *)bufp + 1024,
+ (const UChar **)&unibufp,
+ (const UChar *)unibuf + 3,
+ NULL, (1 > 0), &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "conversion error!\n");
+ exit(-1);
+ }
+
+ for (i = 0; buf[i]; i++)
+ if (buf[i] == 0x1b)
+ printf("%3d %02x ESC\n", i, (unsigned char)buf[i]);
+ else
+ printf("%3d %02x %c\n", i, (unsigned char)buf[i], (unsigned char)buf[i]);
+
+ if (i > 2 && buf[i - 3] == '\x1b' && buf[i - 2] == '(' &&
+ (buf[i - 1] == 'J' || buf[i - 1] == 'B'))
+ printf("Conversion ended with ESC ( J or ESC ( B - success.\n");
+ else
+ printf("Conversion didn't end with ESC ( J or ESC ( B - failed.\n");
+
+
+ if (convto) ucnv_close(convto);
+
+ if (buf) delete[] buf;
+ if (unibuf) delete[] unibuf;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/hangul-johab.txt Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,37 @@
+������� �����a�Q �������i�6���w���b ��á �A��
+
+
+���w���b�w ������� �����a�Q�� ���� ��q�a�� ���i���a. �����a�a�e ���A
+�a�a �A�� �a�� �弁�� ������� �b�� ���i���� ���A���� ���a.
+
+�e��a�����e 17�� �@�e���� �e���w�������e������ �a���� ���w��� 2ѡ�� ��
+�� �����a�Q ���i�A �����a�A�� �j�v�a. ������� �����a�Q�e �����A��
+�����w�� ���b���w �ɵw�i ��Ё ����� ��á�i �A���a�� ���w�a�����᷁ ����
+���� �w�w�i ��З�a�e �wá�a.
+
+��76�ⶥ�� ʁ���� 4�e �e�� �e���{�A ���i�E �� �����a�Q�e �b�� 2����
+�����E �����b�� ���I 4�w�� �e�aȗ�a, ���� �� ���a �w�a�� ������ ���a.
+
+�a���� ���w��� 2ѡ�e ���w 1�} �e��a�� �b���� �a�w�e ������ ���w���b ��
+���a�� ���e 11�� ���� �i�a�I �������a. ���� TRW�a(�t)�� ���� ���i�e �a��
+�� ���w��� 1ѡ���e ���e 99�e 12���A �i�a�� �e�e�� �����A�b�w�a�� �ɶw
+�����a.
+
+(�����i���a [email protected] <mailto:[email protected]> )
+
+���b : 2003.09.17 17:25
+
+100�a�w �a��
+
+�� ���a�A ���e 100�a�w�e �� (2)�巳���a.
+���A 100�a�w ���� | 100�a�w �a��
+
+ٺ ���a�� 100�a�w
+
+���w��(ckscks111) �w���� : 09/18/2003 00:07:06 �宁 : 1
+�b�b�b �a�s���a.
+
+����З(war33333) �w���� : 09/18/2003 01:04:48 �宁 : 0
+�a�����w�� ���i�� �A�� �����a�e �s���a. ������ �����i �a�a�� ��ǩ�� ���e
+�w�b�i �a���i�� ǡ���� �V�s���a. ^^; ���� �g�a�v�s���a.
+���w�b�a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/hangul-utf-8.txt Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,37 @@
+인공위성 추진시스템 국내개발…지상관측 위치 제어
+
+
+지상관측용 인공위성 추진시스템이 국내 처음으로 개발됐다. 우리나라는 이에
+따라 세계 여덟 번째로 인공위성 추력기 개발시설 보유국이 됐다.
+
+산업자원부는 17일 “한화와 한국항공우주연구원이 다목적 실용위성 2호의 위
+성 추진시스템 개발에 성공했다”고 밝혔다. 인공위성 추진시스템은 우주에서
+지구상의 관측대상 촬영을 위해 위성의 위치를 제어하고 지상으로부터의 궤도
+수정 명령을 수행하는 장치다.
+
+총76억원이 투입돼 4년 간의 연구끝에 개발된 이 추진시스템은 추력기 2개로
+구성된 이중추력기 모듈 4쌍과 연료탱크, 배관 및 밸브 등으로 구성돼 있다.
+
+다목적 실용위성 2호는 지상 1m 단위까지 측정이 가능한 초정밀 지상관측 위
+성으로 내년 11월 정식 발사될 예정이다. 미국 TRW사(社)와 공동 개발한 다목
+적 실용위성 1호기는 지난 99년 12월에 발사돼 한반도 지도제작용으로 활용
+중이다.
+
+(송의달기자 [email protected] <mailto:[email protected]> )
+
+입력 : 2003.09.17 17:25
+
+100자평 쓰기
+
+이 기사에 대한 100자평은 총 (2)건입니다.
+전체 100자평 보기 | 100자평 쓰기
+
+▶ 독자추천 100자평
+
+정경식(ckscks111) 등록일 : 09/18/2003 00:07:06 추천수 : 1
+짝짝짝 축하합니다.
+
+이소행(war33333) 등록일 : 09/18/2003 01:04:48 추천수 : 0
+자주국방의 기틀이 되어 주었으면 합니다. 우리도 우리를 스스로 지킬수 있는
+능력을 하루빨리 키워야 겠습니다. ^^; 수고 많으셨습니다.
+똠방각하
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/run_conversion-test-iso-2022.csh Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,24 @@
+#!/bin/csh
+# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+
+set path=( $path /usr/bin /usr/sbin /bin )
+
+set PROG1='cn jp jp-2 jp-3 kr'
+set PROG2='1 2 3'
+set PROCESSOR='32 64'
+
+foreach j ($PROCESSOR)
+ foreach i ($PROG1)
+ /bin/rm -f conversion-test-$i-$j-log.txt
+ ./conversion-test-$i-$j |& tee -a conversion-test-$i-$j-log.txt
+ end
+ foreach i ($PROG2)
+ /bin/rm -f conversion-test$i-$j-log.txt
+ ./conversion-test$i-$j iso-2022-jp |& tee -a conversion-test$i-$j-log.txt
+ end
+end
+
+echo "Log file(s), conversion-test-$i-{32,64}-log.txt, can be "
+echo "found at the current directory."
+
+exit 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/run_johab_test.csh Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,37 @@
+#!/bin/csh
+# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+
+set path=( $path /usr/bin /usr/sbin /bin )
+
+set OS=`uname -s`
+set ARCH=`uname -p`
+set LOCALES='C en_US.UTF-8 en_US.ISO8859-1 ja_JP.PCK de_DE.ISO8859-15 ko_KR.EUC zh_CN.EUC zh_TW.EUC en_US de_DE.ISO8859-1'
+set PROCESSOR='32 64'
+
+set tmpfile=/tmp/.hj$$.txt
+
+foreach j ($PROCESSOR)
+ /bin/rm -f johab_conv_test-$j-log.txt
+ foreach i ($LOCALES)
+ /bin/rm -f $tmpfile
+ echo "env LANG=$i uconv -f UTF-8 -t johab " \
+ "./hangul-utf-8.txt >! $tmpfile" |& \
+ tee -a johab_conv_test-$j-log.txt
+ env LANG=$i uconv -f UTF-8 -t johab \
+ ./hangul-utf-8.txt >! $tmpfile |& \
+ tee -a johab_conv_test-$j-log.txt
+ /usr/bin/diff $tmpfile ./hangul-johab.txt >&! /dev/null
+ if ($status == 0) then
+ echo "Conversion successful." |& tee -a johab_conv_test-$j-log.txt
+ else
+ echo "Conversion failed." |& tee -a johab_conv_test-$j-log.txt
+ endif
+ end
+end
+
+echo "Log file(s), johab_conv_test-{32,64}-log.txt, can be "
+echo "found at the current directory."
+
+/bin/rm -f $tmpfile
+
+exit 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/run_ucnv_createConverter.csh Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,22 @@
+#!/bin/csh
+# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+
+set path=( $path /usr/bin /usr/sbin /bin )
+
+set LOCALES='C en_US.UTF-8 en_US.ISO8859-1 ja_JP.PCK de_DE.ISO8859-15 ko_KR.EUC zh_CN.EUC zh_TW.EUC en_US de_DE.ISO8859-1'
+set PROCESSOR='32 64'
+
+foreach j ($PROCESSOR)
+ /bin/rm -f ucnv_createConverter-$j-log.txt
+ foreach i ($LOCALES)
+ echo "env LANG=$i ./ucnv_createConverter-$j" |& \
+ tee -a ucnv_createConverter-$j-log.txt
+ env LANG=$i ./ucnv_createConverter-$j |& \
+ tee -a ucnv_createConverter-$j-log.txt
+ end
+end
+
+echo "Log file(s), ucnv_createConverter-{32,64}-log.txt, can be "
+echo "found at the current directory."
+
+exit 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/run_ucnv_getDefaultName.csh Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,22 @@
+#!/bin/csh
+# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+
+set path=( $path /usr/bin /usr/sbin /bin )
+
+set LOCALES='C en_US.UTF-8 en_US.ISO8859-1 ja_JP.PCK de_DE.ISO8859-15 ko_KR.EUC zh_CN.EUC zh_TW.EUC en_US de_DE.ISO8859-1'
+set PROCESSOR='32 64'
+
+foreach j ($PROCESSOR)
+ /bin/rm -f ucnv_getDefaultName-$j-log.txt
+ foreach i ($LOCALES)
+ echo "env LANG=$i ./ucnv_getDefaultName-$j" |& \
+ tee -a ucnv_getDefaultName-$j-log.txt
+ env LANG=$i ./ucnv_getDefaultName-$j |& \
+ tee -a ucnv_getDefaultName-$j-log.txt
+ end
+end
+
+echo "Log file(s), ucnv_getDefaultName-{32,64}-log.txt, can be "
+echo "found at the current directory."
+
+exit 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/run_ucnv_getMaxCharSize.csh Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,23 @@
+#!/bin/csh
+# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+
+set path=( $path /usr/bin /usr/sbin /bin )
+
+set LOCALES='C en_US.UTF-8 en_US.ISO8859-1 ja_JP.PCK de_DE.ISO8859-15 ko_KR.EUC zh_CN.EUC zh_TW.EUC en_US de_DE.ISO8859-1'
+set PROCESSOR='32 64'
+
+foreach j ($PROCESSOR)
+ /bin/rm -f ucnv_getMaxCharSize-$j-log.txt
+ foreach i ($LOCALES)
+ echo " " |& tee -a ucnv_getMaxCharSize-$j-log.txt
+ echo "env LANG=$i ./ucnv_getMaxCharSize-$j" |& \
+ tee -a ucnv_getMaxCharSize-$j-log.txt
+ env LANG=$i ./ucnv_getMaxCharSize-$j |& \
+ tee -a ucnv_getMaxCharSize-$j-log.txt
+ end
+end
+
+echo "Log file(s), ucnv_getMaxCharSize-{32,64}-log.txt, can be "
+echo "found at the current directory."
+
+exit 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/run_ucnv_toUChars.csh Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,24 @@
+#!/bin/csh
+# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+
+set path=( $path /usr/bin /usr/sbin /bin )
+
+set LOCALES='C en_US.UTF-8 en_US.ISO8859-1 ja_JP.PCK de_DE.ISO8859-15 ko_KR.EUC zh_CN.EUC zh_TW.EUC en_US de_DE.ISO8859-1'
+set PROCESSOR='32 64'
+
+foreach j ($PROCESSOR)
+ /bin/rm -f ucnv_toUChars-$j-log.txt
+ foreach i ($LOCALES)
+ /bin/rm -f ./core
+ echo "env LANG=$i ./ucnv_toUChars-$j" |& \
+ tee -a ucnv_toUChars-$j-log.txt
+ env LANG=$i ./ucnv_toUChars-$j |& \
+ tee -a ucnv_toUChars-$j-log.txt
+ if ( -f ./core ) echo "ERROR: core file found."
+ end
+end
+
+echo "Log file(s), ucnv_toUChars-{32,64}-log.txt, can be "
+echo "found at the current directory."
+
+exit 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/run_x-windows-949_test.csh Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,29 @@
+#!/bin/csh
+# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+
+set path=( $path /usr/bin /usr/sbin /bin )
+
+set PROCESSOR='32 64'
+set tmpfile=/tmp/.hj$$.txt
+
+foreach j ($PROCESSOR)
+ /bin/rm -f x-windows-949_conv_test-$j-log.txt
+ /bin/rm -f $tmpfile
+ echo "uconv -f x-windows-949 -t UTF-8 ./x-windows-949.txt >! $tmpfile" \
+ |& tee -a x-windows-949_conv_test-$j-log.txt
+ uconv -f x-windows-949 -t UTF-8 ./x-windows-949.txt >! $tmpfile |& \
+ tee -a x-windows-949_conv_test-$j-log.txt
+ /usr/bin/diff $tmpfile ./UTF-8-converted-from-x-windows-949.txt >&! /dev/null
+ if ($status == 0) then
+ echo "Conversion successful." |& tee -a x-windows-949_conv_test-$j-log.txt
+ else
+ echo "Conversion failed." |& tee -a x-windows-949_conv_test-$j-log.txt
+ endif
+end
+
+echo "Log file(s), x-windows-949_conv_test-{32,64}-log.txt, can be "
+echo "found at the current directory."
+
+/bin/rm -f $tmpfile
+
+exit 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/runall.csh Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,15 @@
+#!/bin/csh
+# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+
+set path=( $path /usr/bin /usr/sbin /bin )
+
+/bin/csh ./run_conversion-test-iso-2022.csh
+/bin/csh ./run_ucnv_createConverter.csh
+/bin/csh ./run_ucnv_getDefaultName.csh
+/bin/csh ./run_ucnv_getMaxCharSize.csh
+/bin/csh ./run_ucnv_toUChars.csh
+/bin/csh ./run_johab_test.csh
+/bin/csh ./run_x-windows-949_test.csh
+/bin/csh ./conversion-test.csh
+
+exit 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/ucnv_createConverter.c Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * This program tests whether a long converterName to the
+ * ucnv_createConverter() function would be okay or not.
+ *
+ * You can compile this by doing the following assuming that your
+ * system has the latest ICU packages installed:
+ *
+ * cc -o ucnv_createConverter ucnv_createConverter.c -licui18n -licuuc
+ */
+
+#include <stdio.h>
+#include <locale.h>
+#include <unicode/utypes.h>
+#include <unicode/ucnv.h>
+#include <unicode/urename.h>
+
+const char *converterName = "us-asciiMIME-Version:1.0Content-Transfer-Encoding:7bit Subject:ClaimYourDellLaptopNowFrom:Online Prizes for You<[email protected]>To:[email protected] X-Priority:3Date:Mon09Aug200413:17:53 test test test testskjfdslkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkklj slkjflsd fslfj lsfjlsfjsldfjlsdjfldskfjldsfjlsdkfjlsdjflsdfjlsdfjlsdfjlsdjflsdkfjfjklsdjfklsdfjlsdjflsdfjdslkfjfjljfldjfljfldjflfdjfjjkkkkkkkkkkkddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000";
+
+int
+main(int ac, char **av)
+{
+ UErrorCode err = 0;
+ UConverter *ucnv_open(const char *, UErrorCode *);
+
+
+ (void) setlocale(LC_ALL, "");
+
+ printf("Testing ucnv_open() with bad converterName...\n");
+ printf("Converter id = %08x\n", ucnv_open(converterName, &err));
+ if (err == U_ILLEGAL_ARGUMENT_ERROR) {
+ printf("Success -- the ucnv_open() detected the bad converterName (%08x).\n", err);
+ } else {
+ printf("Failure -- the ucnv_open() did not detect the bad converterName (%08x).\n", err);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/ucnv_getDefaultName.c Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program tests the ucnv_getDefaultName() return value for
+ * the current locale.
+ *
+ * By the way, as a side note, The ucnv_getDefaultName(), oddly enough,
+ * checks LC_ALL, LANG, setlocale(LC_ALL, NULL), setlocale(LC_CTYPE, ""),
+ * and then nl_langinfo(CODESET) to get the default codeset name.
+ * It is wrong for Solaris and any other POSIX-compliant systems but
+ * we keep that order as-is to make the least disruptive changes.
+ * See 4872194 for more detail.
+ *
+ * You can compile this by doing the following assuming that your
+ * system has the latest ICU packages installed:
+ *
+ * cc -o ucnv_getDefaultName ucnv_getDefaultName.c -licui18n -licuuc
+ */
+
+#include <stdio.h>
+#include <locale.h>
+#include <unicode/utypes.h>
+#include <unicode/ucnv.h>
+
+int
+main(int ac, char **av)
+{
+ (void) setlocale(LC_ALL, "");
+
+ printf("Default name = %s\n", ucnv_getDefaultName());
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/ucnv_getMaxCharSize.c Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,87 @@
+// Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <unicode/utypes.h>
+#include <unicode/ucnv.h>
+#include <unicode/unistr.h>
+#include <unicode/translit.h>
+
+main(int ac, char **av)
+{
+ UConverter *convto = 0;
+ UErrorCode err = U_ZERO_ERROR;
+ int8_t i;
+
+ printf("Checking ucnv_getMaxCharSize() return value of UTF-7 conversion:\n");
+ convto = ucnv_open("UTF-7", &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "ucnv_open on UTF-7 error - exiting.\n");
+ exit(-1);
+ }
+
+ i = ucnv_getMaxCharSize(convto);
+ if (i == 5)
+ printf("ucnv_getMaxCharSize() for UTF-7 returned %d -- success.\n", i);
+ else
+ printf("ucnv_getMaxCharSize() for UTF-7 returned %d -- failed.\n", i);
+ if (convto) ucnv_close(convto);
+
+ printf("\nChecking ucnv_getMaxCharSize() return value of MUTF-7 conversion:\n");
+ convto = ucnv_open("MUTF-7", &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "ucnv_open on MUTF-7 error - exiting.\n");
+ exit(-1);
+ }
+
+ i = ucnv_getMaxCharSize(convto);
+ if (i == 8)
+ printf("ucnv_getMaxCharSize() for MUTF-7 returned %d -- success.\n", i);
+ else
+ printf("ucnv_getMaxCharSize() for MUTF-7 returned %d -- failed.\n", i);
+ if (convto) ucnv_close(convto);
+
+ printf("\nChecking ucnv_getMaxCharSize() return value of ISO-2022-JP conversion:\n");
+ convto = ucnv_open("ISO-2022-JP", &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "ucnv_open on ISO-2022-JP error - exiting.\n");
+ exit(-1);
+ }
+
+ i = ucnv_getMaxCharSize(convto);
+ if (i == 9)
+ printf("ucnv_getMaxCharSize() for ISO-2022-JP returned %d -- success.\n", i);
+ else
+ printf("ucnv_getMaxCharSize() for ISO-2022-JP returned %d -- failed.\n", i);
+ if (convto) ucnv_close(convto);
+
+ printf("\nChecking ucnv_getMaxCharSize() return value of ISO-2022-KR conversion:\n");
+ convto = ucnv_open("ISO-2022-KR", &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "ucnv_open on ISO-2022-KR error - exiting.\n");
+ exit(-1);
+ }
+
+ i = ucnv_getMaxCharSize(convto);
+ if (i == 8)
+ printf("ucnv_getMaxCharSize() for ISO-2022-KR returned %d -- success.\n", i);
+ else
+ printf("ucnv_getMaxCharSize() for ISO-2022-KR returned %d -- failed.\n", i);
+ if (convto) ucnv_close(convto);
+
+ printf("\nChecking ucnv_getMaxCharSize() return value of ISO-2022 conversion:\n");
+ convto = ucnv_open("ISO-2022", &err);
+ if (U_FAILURE(err)) {
+ fprintf(stderr, "ucnv_open on ISO-2022 error - exiting.\n");
+ exit(-1);
+ }
+
+ i = ucnv_getMaxCharSize(convto);
+ if (i == 9)
+ printf("ucnv_getMaxCharSize() for ISO-2022 returned %d -- success.\n", i);
+ else
+ printf("ucnv_getMaxCharSize() for ISO-2022 returned %d -- failed.\n", i);
+ if (convto) ucnv_close(convto);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/ucnv_toUChars-amd64-log.txt Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,60 @@
+env LANG=C ./ucnv_toUChars-amd64
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 00416910
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=en_US.UTF-8 ./ucnv_toUChars-amd64
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 00417980
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=en_US.ISO8859-1 ./ucnv_toUChars-amd64
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 00417920
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=ja_JP.PCK ./ucnv_toUChars-amd64
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 00417920
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=de_DE.ISO8859-15 ./ucnv_toUChars-amd64
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 00416910
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=ko_KR.EUC ./ucnv_toUChars-amd64
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 00417920
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=zh_CN.EUC ./ucnv_toUChars-amd64
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 00417920
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=zh_TW.EUC ./ucnv_toUChars-amd64
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 00417920
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=en_US ./ucnv_toUChars-amd64
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 00417920
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=de_DE.ISO8859-1 ./ucnv_toUChars-amd64
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 00417920
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/ucnv_toUChars-i386-log.txt Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,60 @@
+env LANG=C ./ucnv_toUChars-i386
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 08063668
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=en_US.UTF-8 ./ucnv_toUChars-i386
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 08063ca0
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=en_US.ISO8859-1 ./ucnv_toUChars-i386
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 08063c70
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=ja_JP.PCK ./ucnv_toUChars-i386
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 08063c70
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=de_DE.ISO8859-15 ./ucnv_toUChars-i386
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 08063668
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=ko_KR.EUC ./ucnv_toUChars-i386
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 08063c70
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=zh_CN.EUC ./ucnv_toUChars-i386
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 08063c70
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=zh_TW.EUC ./ucnv_toUChars-i386
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 08063c70
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=en_US ./ucnv_toUChars-i386
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 08063a70
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
+env LANG=de_DE.ISO8859-1 ./ucnv_toUChars-i386
+Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...
+(There should be no core dump.)
+Converter id = 08063c70
+Conversion finished with count: 38, err: 0x0
+Conversion done with IMPROPER error code - check it.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/ucnv_toUChars.c Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * This program tests whether a long converterName to the
+ * ucnv_createConverter() function would be okay or not.
+ *
+ * You can compile this by doing the following assuming that your
+ * system has the latest ICU packages installed:
+ *
+ * cc -o ucnv_toUChars-sparc ucnv_toUChars.c -licuuc -licui18n -licudata
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <locale.h>
+#include <unicode/utypes.h>
+#include <unicode/ucnv.h>
+#include <unicode/urename.h>
+
+const char *converterName = "iso-2022-cn";
+
+int
+main(int ac, char **av)
+{
+ UErrorCode err = 0;
+ UConverter *ucnv;
+ UChar t[100];
+ int32_t count;
+
+ (void) setlocale(LC_ALL, "");
+
+ printf("Testing ISO-2022-CN ucnv_toUChar() with bad input buffer...\n");
+ printf("(There should be no core dump.)\n");
+
+ ucnv = ucnv_open(converterName, &err);
+ printf("Converter id = %08x\n", ucnv);
+ if (err == U_ILLEGAL_ARGUMENT_ERROR) {
+ printf("error -- the ucnv_open() failed. (%08x).\n", err);
+ exit (-1);
+ }
+
+ count = ucnv_toUChars(ucnv, t, 100, "mp NaKn>NaKn|Mqr'NaKo:r'Piano Rec", 40, &err);
+
+ printf("Conversion finished with count: %d, err: 0x%x\n", count, err);
+ if (err == 0x12) {
+ printf("Conversion done with proper error code.\n");
+ } else {
+ printf("Conversion done with IMPROPER error code - check it.\n");
+ }
+
+
+ (void) ucnv_close(ucnv);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/icu/internaltests/x-windows-949.txt Tue Nov 02 11:29:20 2010 +0100
@@ -0,0 +1,3 @@
+2001�� 8��1�Ϻ��� '���ν¿��� ������� ��������ȭ'
+�Ǹ鼭 ���� ���ǿ����� ����纰�� �� ��������ῡ ����� ���̸� ���̰�
+�ֽ��ϴ�.