]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/test/cintltst/nucnvtst.c
ICU-66108.tar.gz
[apple/icu.git] / icuSources / test / cintltst / nucnvtst.c
index b985f571e24666171f54b77e4c1c88f7d91c8ede..e85c4d07b5bab01667463d1220b655ea580327a2 100644 (file)
@@ -1,11 +1,13 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
 /********************************************************************
  * COPYRIGHT:
- * Copyright (c) 1997-2010, International Business Machines Corporation and
+ * Copyright (c) 1997-2016, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 /*******************************************************************************
 *
-* File CCONVTST.C
+* File nucnvtst.c
 *
 * Modification History:
 *        Name                     Description
@@ -22,6 +24,7 @@
 #include "unicode/utypes.h"
 #include "unicode/ustring.h"
 #include "unicode/ucol.h"
+#include "unicode/utf16.h"
 #include "cmemory.h"
 #include "nucnvtst.h"
 
@@ -30,7 +33,9 @@ static void TestNextUCharError(UConverter* cnv, const char* source, const char*
 #if !UCONFIG_NO_COLLATION
 static void TestJitterbug981(void);
 #endif
+#if !UCONFIG_NO_LEGACY_CONVERSION
 static void TestJitterbug1293(void);
+#endif
 static void TestNewConvertWithBufferSizes(int32_t osize, int32_t isize) ;
 static void TestConverterTypesAndStarters(void);
 static void TestAmbiguous(void);
@@ -97,6 +102,8 @@ static void TestJitterbug2411(void);
 static void TestJB5275(void);
 static void TestJB5275_1(void);
 static void TestJitterbug6175(void);
+
+static void TestIsFixedWidth(void);
 #endif
 
 static void TestInBufSizes(void);
@@ -323,8 +330,9 @@ void addTestNewConvert(TestNode** root)
    addTest(root, &TestJitterbug2346, "tsconv/nucnvtst/TestJitterbug2346");
    addTest(root, &TestJitterbug2411, "tsconv/nucnvtst/TestJitterbug2411");
    addTest(root, &TestJitterbug6175, "tsconv/nucnvtst/TestJitterbug6175");
-#endif
 
+   addTest(root, &TestIsFixedWidth, "tsconv/nucnvtst/TestIsFixedWidth");
+#endif
 }
 
 
@@ -397,7 +405,7 @@ static ETestConvertResult testConvertFromU( const UChar *source, int sourceLen,
     targ = junkout;
     offs = junokout;
 
-    realBufferSize = (sizeof(junkout)/sizeof(junkout[0]));
+    realBufferSize = UPRV_LENGTHOF(junkout);
     realBufferEnd = junkout + realBufferSize;
     realSourceEnd = source + sourceLen;
 
@@ -464,9 +472,9 @@ static ETestConvertResult testConvertFromU( const UChar *source, int sourceLen,
     if(expectLen != targ-junkout) {
       log_err("Expected %d chars out, got %d %s\n", expectLen, targ-junkout, gNuConvTestName);
       log_verbose("Expected %d chars out, got %d %s\n", expectLen, targ-junkout, gNuConvTestName);
-      printf("\nGot:");
+      fprintf(stderr, "Got:\n");
       printSeqErr((const unsigned char*)junkout, (int32_t)(targ-junkout));
-      printf("\nExpected:");
+      fprintf(stderr, "Expected:\n");
       printSeqErr((const unsigned char*)expect, expectLen);
       return TC_MISMATCH;
     }
@@ -497,9 +505,9 @@ static ETestConvertResult testConvertFromU( const UChar *source, int sourceLen,
     } else {
       log_err("String does not match u->%s\n", gNuConvTestName);
       printUSeqErr(source, sourceLen);
-      printf("\nGot:");
+      fprintf(stderr, "Got:\n");
       printSeqErr((const unsigned char *)junkout, expectLen);
-      printf("\nExpected:");
+      fprintf(stderr, "Expected:\n");
       printSeqErr((const unsigned char *)expect, expectLen);
       
       return TC_MISMATCH;
@@ -555,7 +563,7 @@ static ETestConvertResult testConvertToU( const uint8_t *source, int sourcelen,
     targ = junkout;
     offs = junokout;
 
-    realBufferSize = (sizeof(junkout)/sizeof(junkout[0]));
+    realBufferSize = UPRV_LENGTHOF(junkout);
     realBufferEnd = junkout + realBufferSize;
     realSourceEnd = src + sourcelen;
 
@@ -827,7 +835,7 @@ static void TestNewConvertWithBufferSizes(int32_t outsize, int32_t insize )
 
 
     /*UTF-8*/
-    testConvertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
+    testConvertFromU(sampleText, UPRV_LENGTHOF(sampleText),
         expectedUTF8, sizeof(expectedUTF8), "UTF8", toUTF8Offs,FALSE );
 
     log_verbose("Test surrogate behaviour for UTF8\n");
@@ -838,7 +846,7 @@ static void TestNewConvertWithBufferSizes(int32_t outsize, int32_t insize )
                            0xef, 0xbf, 0xbd
         };
         static const int32_t offsets[]={ 0, 0, 0, 1, 1, 1, 1, 3, 3, 3 };
-        testConvertFromU(testinput, sizeof(testinput)/sizeof(testinput[0]),
+        testConvertFromU(testinput, UPRV_LENGTHOF(testinput),
                          expectedUTF8test2, sizeof(expectedUTF8test2), "UTF8", offsets,FALSE );
 
 
@@ -846,47 +854,47 @@ static void TestNewConvertWithBufferSizes(int32_t outsize, int32_t insize )
 
 #if !UCONFIG_NO_LEGACY_CONVERSION && defined(U_ENABLE_GENERIC_ISO_2022)
     /*ISO-2022*/
-    testConvertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
+    testConvertFromU(sampleText, UPRV_LENGTHOF(sampleText),
         expectedISO2022, sizeof(expectedISO2022), "ISO_2022", toISO2022Offs,FALSE );
 #endif
 
     /*UTF16 LE*/
-    testConvertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
+    testConvertFromU(sampleText, UPRV_LENGTHOF(sampleText),
         expectedUTF16LE, sizeof(expectedUTF16LE), "utf-16le", toUTF16LEOffs,FALSE );
     /*UTF16 BE*/
-    testConvertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
+    testConvertFromU(sampleText, UPRV_LENGTHOF(sampleText),
         expectedUTF16BE, sizeof(expectedUTF16BE), "utf-16be", toUTF16BEOffs,FALSE );
     /*UTF32 LE*/
-    testConvertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
+    testConvertFromU(sampleText, UPRV_LENGTHOF(sampleText),
         expectedUTF32LE, sizeof(expectedUTF32LE), "utf-32le", toUTF32LEOffs,FALSE );
     /*UTF32 BE*/
-    testConvertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
+    testConvertFromU(sampleText, UPRV_LENGTHOF(sampleText),
         expectedUTF32BE, sizeof(expectedUTF32BE), "utf-32be", toUTF32BEOffs,FALSE );
 
     /*LATIN_1*/
-    testConvertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
+    testConvertFromU(sampleText, UPRV_LENGTHOF(sampleText),
         expectedLATIN1, sizeof(expectedLATIN1), "LATIN_1", toLATIN1Offs,FALSE );
 
 #if !UCONFIG_NO_LEGACY_CONVERSION
     /*EBCDIC_STATEFUL*/
-    testConvertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
+    testConvertFromU(sampleText, UPRV_LENGTHOF(sampleText),
         expectedIBM930, sizeof(expectedIBM930), "ibm-930", toIBM930Offs,FALSE );
 
-    testConvertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
+    testConvertFromU(sampleText, UPRV_LENGTHOF(sampleText),
         expectedISO88593, sizeof(expectedISO88593), "iso-8859-3", toISO88593Offs,FALSE );
 
     /*MBCS*/
 
-    testConvertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
+    testConvertFromU(sampleText, UPRV_LENGTHOF(sampleText),
         expectedIBM943, sizeof(expectedIBM943), "ibm-943", toIBM943Offs,FALSE );
     /*DBCS*/
-    testConvertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
+    testConvertFromU(sampleText, UPRV_LENGTHOF(sampleText),
         expectedIBM9027, sizeof(expectedIBM9027), "@ibm9027", toIBM9027Offs,FALSE );
     /*SBCS*/
-    testConvertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
+    testConvertFromU(sampleText, UPRV_LENGTHOF(sampleText),
         expectedIBM920, sizeof(expectedIBM920), "ibm-920", toIBM920Offs,FALSE );
     /*SBCS*/
-    testConvertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
+    testConvertFromU(sampleText, UPRV_LENGTHOF(sampleText),
         expectedISO88593, sizeof(expectedISO88593), "iso-8859-3", toISO88593Offs,FALSE );
 #endif
 
@@ -895,51 +903,51 @@ static void TestNewConvertWithBufferSizes(int32_t outsize, int32_t insize )
 
     /*UTF-8*/
     testConvertToU(expectedUTF8, sizeof(expectedUTF8),
-        sampleText, sizeof(sampleText)/sizeof(sampleText[0]), "utf8", fmUTF8Offs,FALSE);
+        sampleText, UPRV_LENGTHOF(sampleText), "utf8", fmUTF8Offs,FALSE);
 #if !UCONFIG_NO_LEGACY_CONVERSION && defined(U_ENABLE_GENERIC_ISO_2022)
     /*ISO-2022*/
     testConvertToU(expectedISO2022, sizeof(expectedISO2022),
-        sampleText, sizeof(sampleText)/sizeof(sampleText[0]), "ISO_2022", fmISO2022Offs,FALSE);
+        sampleText, UPRV_LENGTHOF(sampleText), "ISO_2022", fmISO2022Offs,FALSE);
 #endif
 
     /*UTF16 LE*/
     testConvertToU(expectedUTF16LE, sizeof(expectedUTF16LE),
-        sampleText, sizeof(sampleText)/sizeof(sampleText[0]), "utf-16le", fmUTF16LEOffs,FALSE);
+        sampleText, UPRV_LENGTHOF(sampleText), "utf-16le", fmUTF16LEOffs,FALSE);
     /*UTF16 BE*/
     testConvertToU(expectedUTF16BE, sizeof(expectedUTF16BE),
-        sampleText, sizeof(sampleText)/sizeof(sampleText[0]), "utf-16be", fmUTF16BEOffs,FALSE);
+        sampleText, UPRV_LENGTHOF(sampleText), "utf-16be", fmUTF16BEOffs,FALSE);
     /*UTF32 LE*/
     testConvertToU(expectedUTF32LE, sizeof(expectedUTF32LE),
-        sampleText, sizeof(sampleText)/sizeof(sampleText[0]), "utf-32le", fmUTF32LEOffs,FALSE);
+        sampleText, UPRV_LENGTHOF(sampleText), "utf-32le", fmUTF32LEOffs,FALSE);
     /*UTF32 BE*/
     testConvertToU(expectedUTF32BE, sizeof(expectedUTF32BE),
-        sampleText, sizeof(sampleText)/sizeof(sampleText[0]), "utf-32be", fmUTF32BEOffs,FALSE);
+        sampleText, UPRV_LENGTHOF(sampleText), "utf-32be", fmUTF32BEOffs,FALSE);
 
 #if !UCONFIG_NO_LEGACY_CONVERSION
     /*EBCDIC_STATEFUL*/
     testConvertToU(expectedIBM930, sizeof(expectedIBM930), sampleTextRoundTripUnmappable, 
-            sizeof(sampleTextRoundTripUnmappable)/sizeof(sampleTextRoundTripUnmappable[0]), "ibm-930", fmIBM930Offs,FALSE);
+            UPRV_LENGTHOF(sampleTextRoundTripUnmappable), "ibm-930", fmIBM930Offs,FALSE);
     /*MBCS*/
     testConvertToU(expectedIBM943, sizeof(expectedIBM943),sampleTextRoundTripUnmappable, 
-            sizeof(sampleTextRoundTripUnmappable)/sizeof(sampleTextRoundTripUnmappable[0]), "ibm-943", fmIBM943Offs,FALSE);
+            UPRV_LENGTHOF(sampleTextRoundTripUnmappable), "ibm-943", fmIBM943Offs,FALSE);
 #endif
 
     /* Try it again to make sure it still works */
     testConvertToU(expectedUTF16LE, sizeof(expectedUTF16LE),
-        sampleText, sizeof(sampleText)/sizeof(sampleText[0]), "utf-16le", fmUTF16LEOffs,FALSE);
+        sampleText, UPRV_LENGTHOF(sampleText), "utf-16le", fmUTF16LEOffs,FALSE);
 
 #if !UCONFIG_NO_LEGACY_CONVERSION
     testConvertToU(expectedMaltese913, sizeof(expectedMaltese913),
-        malteseUChars, sizeof(malteseUChars)/sizeof(malteseUChars[0]), "latin3", NULL,FALSE);
+        malteseUChars, UPRV_LENGTHOF(malteseUChars), "latin3", NULL,FALSE);
 
-    testConvertFromU(malteseUChars, sizeof(malteseUChars)/sizeof(malteseUChars[0]),
+    testConvertFromU(malteseUChars, UPRV_LENGTHOF(malteseUChars),
         expectedMaltese913, sizeof(expectedMaltese913), "iso-8859-3", NULL,FALSE );
 
     /*LMBCS*/
-    testConvertFromU(LMBCSUChars, sizeof(LMBCSUChars)/sizeof(LMBCSUChars[0]),
+    testConvertFromU(LMBCSUChars, UPRV_LENGTHOF(LMBCSUChars),
         expectedLMBCS, sizeof(expectedLMBCS), "LMBCS-1", toLMBCSOffs,FALSE );
     testConvertToU(expectedLMBCS, sizeof(expectedLMBCS),
-        LMBCSUChars, sizeof(LMBCSUChars)/sizeof(LMBCSUChars[0]), "LMBCS-1", fmLMBCSOffs,FALSE);
+        LMBCSUChars, UPRV_LENGTHOF(LMBCSUChars), "LMBCS-1", fmLMBCSOffs,FALSE);
 #endif
 
     /* UTF-7 examples are mostly from http://www.imc.org/rfc2152 */
@@ -950,12 +958,12 @@ static void TestNewConvertWithBufferSizes(int32_t outsize, int32_t insize )
                 Hi Mom -+Jjo--!
                 A+ImIDkQ.
                 +-
-                +ZeVnLIqe
+                +ZeVnLIqe-
             */
             0x48, 0x69, 0x20, 0x4d, 0x6f, 0x6d, 0x20, 0x2d, 0x2b, 0x4a, 0x6a, 0x6f, 0x2d, 0x2d, 0x21,
             0x41, 0x2b, 0x49, 0x6d, 0x49, 0x44, 0x6b, 0x51, 0x2e,
             0x2b, 0x2d,
-            0x2b, 0x5a, 0x65, 0x56, 0x6e, 0x4c, 0x49, 0x71, 0x65
+            0x2b, 0x5a, 0x65, 0x56, 0x6e, 0x4c, 0x49, 0x71, 0x65, 0x2d
         };
         static const UChar unicode[] = {
             /*
@@ -979,7 +987,7 @@ static void TestNewConvertWithBufferSizes(int32_t outsize, int32_t insize )
             0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 9, 10,
             11, 12, 12, 12, 13, 13, 13, 13, 14,
             15, 15,
-            16, 16, 16, 17, 17, 17, 18, 18, 18
+            16, 16, 16, 17, 17, 17, 18, 18, 18, 18
         };
 
         /* same but escaping set O (the exclamation mark) */
@@ -988,12 +996,12 @@ static void TestNewConvertWithBufferSizes(int32_t outsize, int32_t insize )
                 Hi Mom -+Jjo--+ACE-
                 A+ImIDkQ.
                 +-
-                +ZeVnLIqe
+                +ZeVnLIqe-
             */
             0x48, 0x69, 0x20, 0x4d, 0x6f, 0x6d, 0x20, 0x2d, 0x2b, 0x4a, 0x6a, 0x6f, 0x2d, 0x2d, 0x2b, 0x41, 0x43, 0x45, 0x2d,
             0x41, 0x2b, 0x49, 0x6d, 0x49, 0x44, 0x6b, 0x51, 0x2e,
             0x2b, 0x2d,
-            0x2b, 0x5a, 0x65, 0x56, 0x6e, 0x4c, 0x49, 0x71, 0x65
+            0x2b, 0x5a, 0x65, 0x56, 0x6e, 0x4c, 0x49, 0x71, 0x65, 0x2d
         };
         static const int32_t toUnicodeOffsetsR[] = {
             0, 1, 2, 3, 4, 5, 6, 7, 9, 13, 15,
@@ -1005,16 +1013,16 @@ static void TestNewConvertWithBufferSizes(int32_t outsize, int32_t insize )
             0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 9, 10, 10, 10, 10, 10,
             11, 12, 12, 12, 13, 13, 13, 13, 14,
             15, 15,
-            16, 16, 16, 17, 17, 17, 18, 18, 18
+            16, 16, 16, 17, 17, 17, 18, 18, 18, 18
         };
 
-        testConvertFromU(unicode, sizeof(unicode)/U_SIZEOF_UCHAR, utf7, sizeof(utf7), "UTF-7", fromUnicodeOffsets,FALSE);
+        testConvertFromU(unicode, UPRV_LENGTHOF(unicode), utf7, sizeof(utf7), "UTF-7", fromUnicodeOffsets,FALSE);
 
-        testConvertToU(utf7, sizeof(utf7), unicode, sizeof(unicode)/U_SIZEOF_UCHAR, "UTF-7", toUnicodeOffsets,FALSE);
+        testConvertToU(utf7, sizeof(utf7), unicode, UPRV_LENGTHOF(unicode), "UTF-7", toUnicodeOffsets,FALSE);
 
-        testConvertFromU(unicode, sizeof(unicode)/U_SIZEOF_UCHAR, utf7Restricted, sizeof(utf7Restricted), "UTF-7,version=1", fromUnicodeOffsetsR,FALSE);
+        testConvertFromU(unicode, UPRV_LENGTHOF(unicode), utf7Restricted, sizeof(utf7Restricted), "UTF-7,version=1", fromUnicodeOffsetsR,FALSE);
 
-        testConvertToU(utf7Restricted, sizeof(utf7Restricted), unicode, sizeof(unicode)/U_SIZEOF_UCHAR, "UTF-7,version=1", toUnicodeOffsetsR,FALSE);
+        testConvertToU(utf7Restricted, sizeof(utf7Restricted), unicode, UPRV_LENGTHOF(unicode), "UTF-7,version=1", toUnicodeOffsetsR,FALSE);
     }
 
     /*
@@ -1088,9 +1096,9 @@ static void TestNewConvertWithBufferSizes(int32_t outsize, int32_t insize )
             35, 36, 36, 36, 37, 37, 37, 37, 37
         };
 
-        testConvertFromU(unicode, sizeof(unicode)/U_SIZEOF_UCHAR, imap, sizeof(imap), "IMAP-mailbox-name", fromUnicodeOffsets,FALSE);
+        testConvertFromU(unicode, UPRV_LENGTHOF(unicode), imap, sizeof(imap), "IMAP-mailbox-name", fromUnicodeOffsets,FALSE);
 
-        testConvertToU(imap, sizeof(imap), unicode, sizeof(unicode)/U_SIZEOF_UCHAR, "IMAP-mailbox-name", toUnicodeOffsets,FALSE);
+        testConvertToU(imap, sizeof(imap), unicode, UPRV_LENGTHOF(unicode), "IMAP-mailbox-name", toUnicodeOffsets,FALSE);
     }
 
     /* Test UTF-8 bad data handling*/
@@ -1105,29 +1113,39 @@ static void TestNewConvertWithBufferSizes(int32_t outsize, int32_t insize )
             0xf4, 0x8f, 0xbf, 0xbf,         /* 10FFFF */
             0xdf, 0xbf,                     /* 7ff */
             0xbf,                           /* truncated tail */
-            0xf4, 0x90, 0x80, 0x80,         /* 11FFFF */
+            0xf4, 0x90, 0x80, 0x80,         /* 110000 */
             0x02
         };
 
         static const uint16_t utf8Expected[]={
             0x0061,
-            0xfffd,
+            0xfffd, 0xfffd, 0xfffd, 0xfffd,
             0x0000,
             0x0062,
-            0xfffd,
-            0xfffd,
+            0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd,
+            0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd,
             0xdbff, 0xdfff,
             0x07ff,
             0xfffd,
-            0xfffd,
+            0xfffd, 0xfffd, 0xfffd, 0xfffd,
             0x0002
         };
 
         static const int32_t utf8Offsets[]={
-            0, 1, 5, 6, 7, 12, 17, 17, 21, 23, 24, 28
+            0,
+            1, 2, 3, 4,
+            5,
+            6,
+            7, 8, 9, 10, 11,
+            12, 13, 14, 15, 16,
+            17, 17,
+            21,
+            23,
+            24, 25, 26, 27,
+            28
         };
         testConvertToU(utf8, sizeof(utf8),
-                       utf8Expected, sizeof(utf8Expected)/sizeof(utf8Expected[0]), "utf-8", utf8Offsets ,FALSE);
+                       utf8Expected, UPRV_LENGTHOF(utf8Expected), "utf-8", utf8Offsets ,FALSE);
 
     }
 
@@ -1179,8 +1197,8 @@ static void TestNewConvertWithBufferSizes(int32_t outsize, int32_t insize )
         };
 
         testConvertToU(utf32, sizeof(utf32),
-                       utf32Expected, sizeof(utf32Expected)/sizeof(utf32Expected[0]), "utf-32be", utf32Offsets ,FALSE);
-        testConvertFromU(utf32Expected, sizeof(utf32Expected)/sizeof(utf32Expected[0]),
+                       utf32Expected, UPRV_LENGTHOF(utf32Expected), "utf-32be", utf32Offsets ,FALSE);
+        testConvertFromU(utf32Expected, UPRV_LENGTHOF(utf32Expected),
             utf32ExpectedBack, sizeof(utf32ExpectedBack), "utf-32be", utf32OffsetsBack, FALSE);
     }
 
@@ -1232,8 +1250,8 @@ static void TestNewConvertWithBufferSizes(int32_t outsize, int32_t insize )
             8,8,8,8
         };
         testConvertToU(utf32, sizeof(utf32),
-            utf32Expected, sizeof(utf32Expected)/sizeof(utf32Expected[0]), "utf-32le", utf32Offsets,FALSE );
-        testConvertFromU(utf32Expected, sizeof(utf32Expected)/sizeof(utf32Expected[0]),
+            utf32Expected, UPRV_LENGTHOF(utf32Expected), "utf-32le", utf32Offsets,FALSE );
+        testConvertFromU(utf32Expected, UPRV_LENGTHOF(utf32Expected),
             utf32ExpectedBack, sizeof(utf32ExpectedBack), "utf-32le", utf32OffsetsBack, FALSE);
     }
 }
@@ -1270,7 +1288,7 @@ static void TestCoverageMBCS(){
         int32_t  totest1Offs[]        = { 0, 1, 2, 3, 5, };
 
         /*from Unicode*/
-        testConvertFromU(unicodeInput, sizeof(unicodeInput)/sizeof(unicodeInput[0]),
+        testConvertFromU(unicodeInput, UPRV_LENGTHOF(unicodeInput),
             expectedtest1, sizeof(expectedtest1), "@test1", totest1Offs,FALSE );
     }
 
@@ -1288,12 +1306,12 @@ static void TestCoverageMBCS(){
         int32_t fromtest3Offs[]       = { 0, 1, 2, 3, 6, 6, 7, 7, 10 };
 
         /*from Unicode*/
-        testConvertFromU(unicodeInput, sizeof(unicodeInput)/sizeof(unicodeInput[0]),
+        testConvertFromU(unicodeInput, UPRV_LENGTHOF(unicodeInput),
             expectedtest3, sizeof(expectedtest3), "@test3", totest3Offs,FALSE );
 
         /*to Unicode*/
         testConvertToU(test3input, sizeof(test3input),
-            expectedUnicode, sizeof(expectedUnicode)/sizeof(expectedUnicode[0]), "@test3", fromtest3Offs ,FALSE);
+            expectedUnicode, UPRV_LENGTHOF(expectedUnicode), "@test3", fromtest3Offs ,FALSE);
 
     }
 
@@ -1311,12 +1329,12 @@ static void TestCoverageMBCS(){
         static const int32_t fromtest4Offs[] = { 0, 1, 2, 3, 7, 7, 8, 8, 12,};
 
         /*from Unicode*/
-        testConvertFromU(unicodeInput, sizeof(unicodeInput)/sizeof(unicodeInput[0]),
+        testConvertFromU(unicodeInput, UPRV_LENGTHOF(unicodeInput),
             expectedtest4, sizeof(expectedtest4), "@test4", totest4Offs,FALSE );
 
         /*to Unicode*/
         testConvertToU(test4input, sizeof(test4input),
-            expectedUnicode, sizeof(expectedUnicode)/sizeof(expectedUnicode[0]), "@test4", fromtest4Offs,FALSE );
+            expectedUnicode, UPRV_LENGTHOF(expectedUnicode), "@test4", fromtest4Offs,FALSE );
 
     }
 #if 0
@@ -1540,7 +1558,7 @@ static void TestAmbiguous()
         return;
     }
     /* convert target from SJIS to Unicode */
-    sjisLength = ucnv_toUChars(sjis_cnv, sjisResult, sizeof(sjisResult)/U_SIZEOF_UCHAR, target, (int32_t)strlen(target), &status);
+    sjisLength = ucnv_toUChars(sjis_cnv, sjisResult, UPRV_LENGTHOF(sjisResult), target, (int32_t)strlen(target), &status);
     if (U_FAILURE(status))
     {
         log_err("Failed to convert the SJIS string.\n");
@@ -1549,7 +1567,7 @@ static void TestAmbiguous()
         return;
     }
     /* convert target from Latin-1 to Unicode */
-    /*asciiLength =*/ ucnv_toUChars(ascii_cnv, asciiResult, sizeof(asciiResult)/U_SIZEOF_UCHAR, target, (int32_t)strlen(target), &status);
+    /*asciiLength =*/ ucnv_toUChars(ascii_cnv, asciiResult, UPRV_LENGTHOF(asciiResult), target, (int32_t)strlen(target), &status);
     if (U_FAILURE(status))
     {
         log_err("Failed to convert the Latin-1 string.\n");
@@ -1657,7 +1675,7 @@ TestSignatureDetection(){
         int32_t signatureLength = -1;
         const char* source = NULL;
         const char* enc = NULL;
-        for( ; i<sizeof(data)/sizeof(char*); i++){
+        for( ; i<UPRV_LENGTHOF(data); i++){
             err = U_ZERO_ERROR;
             source = data[i];
             enc = ucnv_detectUnicodeSignature(source, -1 , &signatureLength, &err);
@@ -1770,7 +1788,7 @@ TestSignatureDetection(){
         int32_t sourceLength=-1;
         const char* source = NULL;
         const char* enc = NULL;
-        for( ; i<sizeof(data)/sizeof(char*); i++){
+        for( ; i<UPRV_LENGTHOF(data); i++){
             err = U_ZERO_ERROR;
             source = data[i];
             sourceLength = len[i];
@@ -1822,7 +1840,7 @@ static void TestUTF7() {
     UErrorCode errorCode=U_ZERO_ERROR;
     UConverter *cnv=ucnv_open("UTF-7", &errorCode);
     if(U_FAILURE(errorCode)) {
-        log_err("Unable to open a UTF-7 converter: %s\n", u_errorName(errorCode)); /* sholdn't be a data err */
+        log_data_err("Unable to open a UTF-7 converter: %s\n", u_errorName(errorCode));
         return;
     }
     TestNextUChar(cnv, source, limit, results, "UTF-7");
@@ -1865,7 +1883,7 @@ static void TestIMAP() {
     UErrorCode errorCode=U_ZERO_ERROR;
     UConverter *cnv=ucnv_open("IMAP-mailbox-name", &errorCode);
     if(U_FAILURE(errorCode)) {
-        log_err("Unable to open a IMAP-mailbox-name converter: %s\n", u_errorName(errorCode)); /* sholdn't be a data err */
+        log_data_err("Unable to open a IMAP-mailbox-name converter: %s\n", u_errorName(errorCode));
         return;
     }
     TestNextUChar(cnv, source, limit, results, "IMAP-mailbox-name");
@@ -1998,7 +2016,7 @@ static void TestCESU8() {
     UErrorCode errorCode=U_ZERO_ERROR;
     UConverter *cnv=ucnv_open("CESU-8", &errorCode);
     if(U_FAILURE(errorCode)) {
-        log_err("Unable to open a CESU-8 converter: %s\n", u_errorName(errorCode));
+        log_data_err("Unable to open a CESU-8 converter: %s\n", u_errorName(errorCode));
         return;
     }
     TestNextUChar(cnv, source, limit, results, "CESU-8");
@@ -2218,7 +2236,7 @@ static void TestUTF32() {
     UErrorCode errorCode=U_ZERO_ERROR;
     UConverter *cnv=ucnv_open("UTF-32", &errorCode);
     if(U_FAILURE(errorCode)) {
-        log_err("Unable to open a UTF-32 converter: %s\n", u_errorName(errorCode));
+        log_data_err("Unable to open a UTF-32 converter: %s\n", u_errorName(errorCode));
         return;
     }
 
@@ -2294,7 +2312,7 @@ TestUTF32BE() {
     UErrorCode errorCode=U_ZERO_ERROR;
     UConverter *cnv=ucnv_open("UTF-32BE", &errorCode);
     if(U_FAILURE(errorCode)) {
-        log_err("Unable to open a UTF-32BE converter: %s\n", u_errorName(errorCode));
+        log_data_err("Unable to open a UTF-32BE converter: %s\n", u_errorName(errorCode));
         return;
     }
     TestNextUChar(cnv, source, limit, results, "UTF-32BE");
@@ -2365,7 +2383,7 @@ TestUTF32LE() {
     UErrorCode errorCode=U_ZERO_ERROR;
     UConverter *cnv=ucnv_open("UTF-32LE", &errorCode);
     if(U_FAILURE(errorCode)) {
-        log_err("Unable to open a UTF-32LE converter: %s\n", u_errorName(errorCode));
+        log_data_err("Unable to open a UTF-32LE converter: %s\n", u_errorName(errorCode));
         return;
     }
     TestNextUChar(cnv, source, limit, results, "UTF-32LE");
@@ -2967,9 +2985,9 @@ TestGetNextUChar2022(UConverter* cnv, const char* source, const char* limit,
             log_err("%s ucnv_getNextUChar() failed: %s\n", message, u_errorName(errorCode));
             break;
         } else {
-            if(UTF_IS_FIRST_SURROGATE(*r)){
+            if(U16_IS_LEAD(*r)){
                 int i =0, len = 2;
-                UTF_NEXT_CHAR_SAFE(r, i, len, exC, FALSE);
+                U16_NEXT(r, i, len, exC);
                 r++;
             }else{
                 exC = *r;
@@ -3077,23 +3095,24 @@ TestHZ() {
     UChar *uTarget;
     char *cTarget;
     const char *cTargetLimit;
-    char *cBuf;
-    UChar *uBuf,*test;
+    char *cBuf = NULL;
+    UChar *uBuf = NULL;
+    UChar *test;
     int32_t uBufSize = 120;
     UErrorCode errorCode=U_ZERO_ERROR;
-    UConverter *cnv;
+    UConverter *cnv = NULL;
     int32_t* offsets = (int32_t*) malloc(uBufSize * sizeof(int32_t) * 5);
     int32_t* myOff= offsets;
     cnv=ucnv_open("HZ", &errorCode);
     if(U_FAILURE(errorCode)) {
         log_data_err("Unable to open HZ converter: %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
 
     uBuf =  (UChar*)malloc(uBufSize * sizeof(UChar)*5);
     cBuf =(char*)malloc(uBufSize * sizeof(char) * 5);
     uSource = (const UChar*)in;
-    uSourceLimit=(const UChar*)in + (sizeof(in)/sizeof(in[0]));
+    uSourceLimit=(const UChar*)in + UPRV_LENGTHOF(in);
     cTarget = cBuf;
     cTargetLimit = cBuf +uBufSize*5;
     uTarget = uBuf;
@@ -3101,7 +3120,7 @@ TestHZ() {
     ucnv_fromUnicode( cnv , &cTarget, cTargetLimit,&uSource,uSourceLimit,myOff,TRUE, &errorCode);
     if(U_FAILURE(errorCode)){
         log_err("ucnv_fromUnicode conversion failed reason %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
     cSource = cBuf;
     cSourceLimit =cTarget;
@@ -3110,7 +3129,7 @@ TestHZ() {
     ucnv_toUnicode(cnv,&uTarget,uTargetLimit,&cSource,cSourceLimit,myOff,TRUE,&errorCode);
     if(U_FAILURE(errorCode)){
         log_err("ucnv_toUnicode conversion failed reason %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
     uSource = (const UChar*)in;
     while(uSource<uSourceLimit){
@@ -3122,10 +3141,12 @@ TestHZ() {
         test++;
     }
     TestGetNextUChar2022(cnv, cBuf, cTarget, in, "HZ encoding");
-    TestSmallTargetBuffer(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
-    TestSmallSourceBuffer(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
-    TestToAndFromUChars(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
+    TestSmallTargetBuffer(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
+    TestSmallSourceBuffer(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
+    TestToAndFromUChars(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
     TestJitterbug930("csISO2022JP");
+
+cleanup:
     ucnv_close(cnv);
     free(offsets);
     free(uBuf);
@@ -3270,7 +3291,7 @@ TestISCII(){
         0xEF, 0x30,
 
     };
-    testConvertToU(byteArr,(sizeof(byteArr)),in,(sizeof(in)/U_SIZEOF_UCHAR),"x-iscii-de",NULL,TRUE);
+    testConvertToU(byteArr,(sizeof(byteArr)),in,UPRV_LENGTHOF(in),"x-iscii-de",NULL,TRUE);
     TestConv(in,(sizeof(in)/2),"ISCII,version=0","hindi", (char *)byteArr,sizeof(byteArr));    
 
 }
@@ -3296,23 +3317,24 @@ TestISO_2022_JP() {
     UChar *uTarget;
     char *cTarget;
     const char *cTargetLimit;
-    char *cBuf;
-    UChar *uBuf,*test;
+    char *cBuf = NULL;
+    UChar *uBuf = NULL;
+    UChar *test;
     int32_t uBufSize = 120;
     UErrorCode errorCode=U_ZERO_ERROR;
-    UConverter *cnv;
+    UConverter *cnv = NULL;
     int32_t* offsets = (int32_t*) malloc(uBufSize * sizeof(int32_t) * 5);
     int32_t* myOff= offsets;
     cnv=ucnv_open("ISO_2022_JP_1", &errorCode);
     if(U_FAILURE(errorCode)) {
         log_data_err("Unable to open an ISO_2022_JP_1 converter: %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
 
     uBuf =  (UChar*)malloc(uBufSize * sizeof(UChar)*5);
     cBuf =(char*)malloc(uBufSize * sizeof(char) * 5);
     uSource = (const UChar*)in;
-    uSourceLimit=(const UChar*)in + (sizeof(in)/sizeof(in[0]));
+    uSourceLimit=(const UChar*)in + UPRV_LENGTHOF(in);
     cTarget = cBuf;
     cTargetLimit = cBuf +uBufSize*5;
     uTarget = uBuf;
@@ -3320,7 +3342,7 @@ TestISO_2022_JP() {
     ucnv_fromUnicode( cnv , &cTarget, cTargetLimit,&uSource,uSourceLimit,myOff,TRUE, &errorCode);
     if(U_FAILURE(errorCode)){
         log_err("ucnv_fromUnicode conversion failed reason %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
     cSource = cBuf;
     cSourceLimit =cTarget;
@@ -3329,7 +3351,7 @@ TestISO_2022_JP() {
     ucnv_toUnicode(cnv,&uTarget,uTargetLimit,&cSource,cSourceLimit,myOff,TRUE,&errorCode);
     if(U_FAILURE(errorCode)){
         log_err("ucnv_toUnicode conversion failed reason %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
 
     uSource = (const UChar*)in;
@@ -3342,11 +3364,13 @@ TestISO_2022_JP() {
         test++;
     }
 
-    TestSmallTargetBuffer(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
-    TestSmallSourceBuffer(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
+    TestSmallTargetBuffer(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
+    TestSmallSourceBuffer(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
     TestGetNextUChar2022(cnv, cBuf, cTarget, in, "ISO-2022-JP encoding");
-    TestToAndFromUChars(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
+    TestToAndFromUChars(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
     TestJitterbug930("csISO2022JP");
+
+cleanup:
     ucnv_close(cnv);
     free(uBuf);
     free(cBuf);
@@ -3471,9 +3495,9 @@ unescape(UChar* dst, int32_t dstLen,const char* src,int32_t srcLen,UErrorCode *s
         }
         if(dstIndex < dstLen){
             if(c>0xFFFF){
-               dst[dstIndex++] = UTF16_LEAD(c);
+               dst[dstIndex++] = U16_LEAD(c);
                if(dstIndex<dstLen){
-                    dst[dstIndex]=UTF16_TRAIL(c);
+                    dst[dstIndex]=U16_TRAIL(c);
                }else{
                    *status=U_BUFFER_OVERFLOW_ERROR;
                }
@@ -3511,8 +3535,8 @@ TestFullRoundtrip(const char* cp){
             usource[0] =(UChar) i;
             len=1;
         }else{
-            usource[0]=UTF16_LEAD(i);
-            usource[1]=UTF16_TRAIL(i);
+            usource[0]=U16_LEAD(i);
+            usource[1]=U16_TRAIL(i);
             len=2;
         }
         ulen=len;
@@ -3569,8 +3593,19 @@ TestRoundTrippingAllUTF(void){
         TestFullRoundtrip("UTF-7,version=1");
         log_verbose("Running exhaustive round trip test for IMAP-mailbox-name\n");
         TestFullRoundtrip("IMAP-mailbox-name");
-        log_verbose("Running exhaustive round trip test for GB18030\n");
-        TestFullRoundtrip("GB18030");
+        /*
+         *
+         * With the update to GB18030 2005 (Ticket #8274), this test will fail because the 2005 version of
+         * GB18030 contains mappings to actual Unicode codepoints (which were previously mapped to PUA).
+         * The old mappings remain as fallbacks.
+         * This test may be reintroduced at a later time.
+         *
+         * 110118 - mow
+         */
+         /*
+         log_verbose("Running exhaustive round trip test for GB18030\n");
+         TestFullRoundtrip("GB18030");
+         */
     }
 }
 
@@ -3731,7 +3766,7 @@ TestSCSU() {
           "\\uf95b\\u2458\\u2468\\u0e20\\uf51b\\ue36e\\ubfc1\\u0080\\u02dd\\uf1b5\\u0cf3\\u6059\\u7489",
     };
     int i=0;
-    for(;i<sizeof(fTestCases)/sizeof(*fTestCases);i++){
+    for(;i<UPRV_LENGTHOF(fTestCases);i++){
         const char* cSrc = fTestCases[i];
         UErrorCode status = U_ZERO_ERROR;
         int32_t cSrcLen,srcLen;
@@ -3843,7 +3878,7 @@ TestISO_2022_JP_1() {
     uBuf =  (UChar*)malloc(uBufSize * sizeof(UChar)*5);
     cBuf =(char*)malloc(uBufSize * sizeof(char) * 5);
     uSource = (const UChar*)in;
-    uSourceLimit=(const UChar*)in + (sizeof(in)/sizeof(in[0]));
+    uSourceLimit=(const UChar*)in + UPRV_LENGTHOF(in);
     cTarget = cBuf;
     cTargetLimit = cBuf +uBufSize*5;
     uTarget = uBuf;
@@ -3878,8 +3913,8 @@ TestISO_2022_JP_1() {
         static const uint8_t source2[]={0x0e,0x24,0x053};
         TestNextUCharError(cnv, (const char*)source2, (const char*)source2+sizeof(source2), U_ZERO_ERROR, "an invalid character [ISO-2022-JP-1]");
     }
-    TestSmallTargetBuffer(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
-    TestSmallSourceBuffer(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
+    TestSmallTargetBuffer(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
+    TestSmallSourceBuffer(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
     ucnv_close(cnv);
     free(uBuf);
     free(cBuf);
@@ -3917,23 +3952,24 @@ TestISO_2022_JP_2() {
     UChar *uTarget;
     char *cTarget;
     const char *cTargetLimit;
-    char *cBuf;
-    UChar *uBuf,*test;
+    char *cBuf = NULL;
+    UChar *uBuf = NULL;
+    UChar *test;
     int32_t uBufSize = 120;
     UErrorCode errorCode=U_ZERO_ERROR;
-    UConverter *cnv;
+    UConverter *cnv = NULL;
     int32_t* offsets = (int32_t*) malloc(uBufSize * sizeof(int32_t) * 5);
     int32_t* myOff= offsets;
     cnv=ucnv_open("ISO_2022_JP_2", &errorCode);
     if(U_FAILURE(errorCode)) {
         log_data_err("Unable to open a iso-2022 converter: %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
 
     uBuf =  (UChar*)malloc(uBufSize * sizeof(UChar)*5);
     cBuf =(char*)malloc(uBufSize * sizeof(char) * 5);
     uSource = (const UChar*)in;
-    uSourceLimit=(const UChar*)in + (sizeof(in)/sizeof(in[0]));
+    uSourceLimit=(const UChar*)in + UPRV_LENGTHOF(in);
     cTarget = cBuf;
     cTargetLimit = cBuf +uBufSize*5;
     uTarget = uBuf;
@@ -3941,7 +3977,7 @@ TestISO_2022_JP_2() {
     ucnv_fromUnicode( cnv , &cTarget, cTargetLimit,&uSource,uSourceLimit,myOff,TRUE, &errorCode);
     if(U_FAILURE(errorCode)){
         log_err("ucnv_fromUnicode conversion failed reason %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
     cSource = cBuf;
     cSourceLimit =cTarget;
@@ -3950,7 +3986,7 @@ TestISO_2022_JP_2() {
     ucnv_toUnicode(cnv,&uTarget,uTargetLimit,&cSource,cSourceLimit,myOff,TRUE,&errorCode);
     if(U_FAILURE(errorCode)){
         log_err("ucnv_toUnicode conversion failed reason %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
     uSource = (const UChar*)in;
     while(uSource<uSourceLimit){
@@ -3961,15 +3997,17 @@ TestISO_2022_JP_2() {
         uSource++;
         test++;
     }
-    TestSmallTargetBuffer(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
-    TestSmallSourceBuffer(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
-    TestToAndFromUChars(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
+    TestSmallTargetBuffer(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
+    TestSmallSourceBuffer(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
+    TestToAndFromUChars(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
     /*Test for the condition where there is an invalid character*/
     ucnv_reset(cnv);
     {
         static const uint8_t source2[]={0x0e,0x24,0x053};
         TestNextUCharError(cnv, (const char*)source2, (const char*)source2+sizeof(source2), U_ZERO_ERROR, "an invalid character [ISO-2022-JP-2]");
     }
+
+cleanup:
     ucnv_close(cnv);
     free(uBuf);
     free(cBuf);
@@ -3994,23 +4032,24 @@ TestISO_2022_KR() {
     UChar *uTarget;
     char *cTarget;
     const char *cTargetLimit;
-    char *cBuf;
-    UChar *uBuf,*test;
+    char *cBuf = NULL;
+    UChar *uBuf = NULL;
+    UChar *test;
     int32_t uBufSize = 120;
     UErrorCode errorCode=U_ZERO_ERROR;
-    UConverter *cnv;
+    UConverter *cnv = NULL;
     int32_t* offsets = (int32_t*) malloc(uBufSize * sizeof(int32_t) * 5);
     int32_t* myOff= offsets;
     cnv=ucnv_open("ISO_2022,locale=kr", &errorCode);
     if(U_FAILURE(errorCode)) {
         log_data_err("Unable to open a iso-2022 converter: %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
 
     uBuf =  (UChar*)malloc(uBufSize * sizeof(UChar)*5);
     cBuf =(char*)malloc(uBufSize * sizeof(char) * 5);
     uSource = (const UChar*)in;
-    uSourceLimit=(const UChar*)in + (sizeof(in)/sizeof(in[0]));
+    uSourceLimit=(const UChar*)in + UPRV_LENGTHOF(in);
     cTarget = cBuf;
     cTargetLimit = cBuf +uBufSize*5;
     uTarget = uBuf;
@@ -4018,7 +4057,7 @@ TestISO_2022_KR() {
     ucnv_fromUnicode( cnv , &cTarget, cTargetLimit,&uSource,uSourceLimit,myOff,TRUE, &errorCode);
     if(U_FAILURE(errorCode)){
         log_err("ucnv_fromUnicode conversion failed reason %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
     cSource = cBuf;
     cSourceLimit =cTarget;
@@ -4027,7 +4066,7 @@ TestISO_2022_KR() {
     ucnv_toUnicode(cnv,&uTarget,uTargetLimit,&cSource,cSourceLimit,myOff,TRUE,&errorCode);
     if(U_FAILURE(errorCode)){
         log_err("ucnv_toUnicode conversion failed reason %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
     uSource = (const UChar*)in;
     while(uSource<uSourceLimit){
@@ -4038,9 +4077,9 @@ TestISO_2022_KR() {
         test++;
     }
     TestGetNextUChar2022(cnv, cBuf, cTarget, in, "ISO-2022-KR encoding");
-    TestSmallTargetBuffer(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
-    TestSmallSourceBuffer(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
-    TestToAndFromUChars(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
+    TestSmallTargetBuffer(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
+    TestSmallSourceBuffer(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
+    TestToAndFromUChars(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
     TestJitterbug930("csISO2022KR");
     /*Test for the condition where there is an invalid character*/
     ucnv_reset(cnv);
@@ -4049,6 +4088,8 @@ TestISO_2022_KR() {
         ucnv_setToUCallBack(cnv, UCNV_TO_U_CALLBACK_STOP, NULL, NULL, NULL, &errorCode);
         TestNextUCharError(cnv, (const char*)source2, (const char*)source2+sizeof(source2), U_ILLEGAL_ESCAPE_SEQUENCE, "an invalid character [ISO-2022-KR]");
     }
+
+cleanup:
     ucnv_close(cnv);
     free(uBuf);
     free(cBuf);
@@ -4073,23 +4114,24 @@ TestISO_2022_KR_1() {
     UChar *uTarget;
     char *cTarget;
     const char *cTargetLimit;
-    char *cBuf;
-    UChar *uBuf,*test;
+    char *cBuf = NULL;
+    UChar *uBuf = NULL;
+    UChar *test;
     int32_t uBufSize = 120;
     UErrorCode errorCode=U_ZERO_ERROR;
-    UConverter *cnv;
+    UConverter *cnv = NULL;
     int32_t* offsets = (int32_t*) malloc(uBufSize * sizeof(int32_t) * 5);
     int32_t* myOff= offsets;
     cnv=ucnv_open("ibm-25546", &errorCode);
     if(U_FAILURE(errorCode)) {
         log_data_err("Unable to open a iso-2022 converter: %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
 
     uBuf =  (UChar*)malloc(uBufSize * sizeof(UChar)*5);
     cBuf =(char*)malloc(uBufSize * sizeof(char) * 5);
     uSource = (const UChar*)in;
-    uSourceLimit=(const UChar*)in + (sizeof(in)/sizeof(in[0]));
+    uSourceLimit=(const UChar*)in + UPRV_LENGTHOF(in);
     cTarget = cBuf;
     cTargetLimit = cBuf +uBufSize*5;
     uTarget = uBuf;
@@ -4097,7 +4139,7 @@ TestISO_2022_KR_1() {
     ucnv_fromUnicode( cnv , &cTarget, cTargetLimit,&uSource,uSourceLimit,myOff,TRUE, &errorCode);
     if(U_FAILURE(errorCode)){
         log_err("ucnv_fromUnicode conversion failed reason %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
     cSource = cBuf;
     cSourceLimit =cTarget;
@@ -4106,7 +4148,7 @@ TestISO_2022_KR_1() {
     ucnv_toUnicode(cnv,&uTarget,uTargetLimit,&cSource,cSourceLimit,myOff,TRUE,&errorCode);
     if(U_FAILURE(errorCode)){
         log_err("ucnv_toUnicode conversion failed reason %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
     uSource = (const UChar*)in;
     while(uSource<uSourceLimit){
@@ -4118,10 +4160,10 @@ TestISO_2022_KR_1() {
     }
     ucnv_reset(cnv);
     TestGetNextUChar2022(cnv, cBuf, cTarget, in, "ISO-2022-KR encoding");
-    TestSmallTargetBuffer(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
-    TestSmallSourceBuffer(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
+    TestSmallTargetBuffer(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
+    TestSmallSourceBuffer(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
     ucnv_reset(cnv);
-    TestToAndFromUChars(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
+    TestToAndFromUChars(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
         /*Test for the condition where there is an invalid character*/
     ucnv_reset(cnv);
     {
@@ -4129,6 +4171,8 @@ TestISO_2022_KR_1() {
         ucnv_setToUCallBack(cnv, UCNV_TO_U_CALLBACK_STOP, NULL, NULL, NULL, &errorCode);
         TestNextUCharError(cnv, (const char*)source2, (const char*)source2+sizeof(source2), U_ILLEGAL_ESCAPE_SEQUENCE, "an invalid character [ISO-2022-KR]");
     }
+
+cleanup:
     ucnv_close(cnv);
     free(uBuf);
     free(cBuf);
@@ -4238,11 +4282,11 @@ TestJIS(){
         };
 
         testConvertToU(sampleTextJIS,sizeof(sampleTextJIS),expectedISO2022JIS,
-            sizeof(expectedISO2022JIS)/sizeof(expectedISO2022JIS[0]),"JIS", toISO2022JISOffs,TRUE);
+            UPRV_LENGTHOF(expectedISO2022JIS),"JIS", toISO2022JISOffs,TRUE);
         testConvertToU(sampleTextJIS7,sizeof(sampleTextJIS7),expectedISO2022JIS7,
-            sizeof(expectedISO2022JIS7)/sizeof(expectedISO2022JIS7[0]),"JIS7", toISO2022JIS7Offs,TRUE);
+            UPRV_LENGTHOF(expectedISO2022JIS7),"JIS7", toISO2022JIS7Offs,TRUE);
         testConvertToU(sampleTextJIS8,sizeof(sampleTextJIS8),expectedISO2022JIS8,
-            sizeof(expectedISO2022JIS8)/sizeof(expectedISO2022JIS8[0]),"JIS8", toISO2022JIS8Offs,TRUE);
+            UPRV_LENGTHOF(expectedISO2022JIS8),"JIS8", toISO2022JIS8Offs,TRUE);
     }
 
 }
@@ -4379,23 +4423,24 @@ TestISO_2022_CN_EXT() {
     UChar *uTarget;
     char *cTarget;
     const char *cTargetLimit;
-    char *cBuf;
-    UChar *uBuf,*test;
+    char *cBuf = NULL;
+    UChar *uBuf = NULL;
+    UChar *test;
     int32_t uBufSize = 180;
     UErrorCode errorCode=U_ZERO_ERROR;
-    UConverter *cnv;
+    UConverter *cnv = NULL;
     int32_t* offsets = (int32_t*) malloc(uBufSize * sizeof(int32_t) * 5);
     int32_t* myOff= offsets;
     cnv=ucnv_open("ISO_2022,locale=cn,version=1", &errorCode);
     if(U_FAILURE(errorCode)) {
         log_data_err("Unable to open a iso-2022 converter: %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
 
     uBuf =  (UChar*)malloc(uBufSize * sizeof(UChar)*5);
     cBuf =(char*)malloc(uBufSize * sizeof(char) * 10);
     uSource = (const UChar*)in;
-    uSourceLimit=(const UChar*)in + (sizeof(in)/sizeof(in[0]));
+    uSourceLimit=(const UChar*)in + UPRV_LENGTHOF(in);
     cTarget = cBuf;
     cTargetLimit = cBuf +uBufSize*5;
     uTarget = uBuf;
@@ -4403,7 +4448,7 @@ TestISO_2022_CN_EXT() {
     ucnv_fromUnicode( cnv , &cTarget, cTargetLimit,&uSource,uSourceLimit,myOff,TRUE, &errorCode);
     if(U_FAILURE(errorCode)){
         log_err("ucnv_fromUnicode conversion failed reason %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
     cSource = cBuf;
     cSourceLimit =cTarget;
@@ -4412,7 +4457,7 @@ TestISO_2022_CN_EXT() {
     ucnv_toUnicode(cnv,&uTarget,uTargetLimit,&cSource,cSourceLimit,myOff,TRUE,&errorCode);
     if(U_FAILURE(errorCode)){
         log_err("ucnv_toUnicode conversion failed reason %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
     uSource = (const UChar*)in;
     while(uSource<uSourceLimit){
@@ -4425,14 +4470,16 @@ TestISO_2022_CN_EXT() {
         uSource++;
         test++;
     }
-    TestSmallTargetBuffer(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
-    TestSmallSourceBuffer(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
+    TestSmallTargetBuffer(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
+    TestSmallSourceBuffer(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
     /*Test for the condition where there is an invalid character*/
     ucnv_reset(cnv);
     {
         static const uint8_t source2[]={0x0e,0x24,0x053};
         TestNextUCharError(cnv, (const char*)source2, (const char*)source2+sizeof(source2), U_ZERO_ERROR, "an invalid character [ISO-2022-CN-EXT]");
     }
+
+cleanup:
     ucnv_close(cnv);
     free(uBuf);
     free(cBuf);
@@ -4478,23 +4525,24 @@ TestISO_2022_CN() {
     UChar *uTarget;
     char *cTarget;
     const char *cTargetLimit;
-    char *cBuf;
-    UChar *uBuf,*test;
+    char *cBuf = NULL;
+    UChar *uBuf = NULL;
+    UChar *test;
     int32_t uBufSize = 180;
     UErrorCode errorCode=U_ZERO_ERROR;
-    UConverter *cnv;
+    UConverter *cnv = NULL;
     int32_t* offsets = (int32_t*) malloc(uBufSize * sizeof(int32_t) * 5);
     int32_t* myOff= offsets;
     cnv=ucnv_open("ISO_2022,locale=cn,version=0", &errorCode);
     if(U_FAILURE(errorCode)) {
         log_data_err("Unable to open a iso-2022 converter: %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
 
     uBuf =  (UChar*)malloc(uBufSize * sizeof(UChar)*5);
     cBuf =(char*)malloc(uBufSize * sizeof(char) * 10);
     uSource = (const UChar*)in;
-    uSourceLimit=(const UChar*)in + (sizeof(in)/sizeof(in[0]));
+    uSourceLimit=(const UChar*)in + UPRV_LENGTHOF(in);
     cTarget = cBuf;
     cTargetLimit = cBuf +uBufSize*5;
     uTarget = uBuf;
@@ -4502,7 +4550,7 @@ TestISO_2022_CN() {
     ucnv_fromUnicode( cnv , &cTarget, cTargetLimit,&uSource,uSourceLimit,myOff,TRUE, &errorCode);
     if(U_FAILURE(errorCode)){
         log_err("ucnv_fromUnicode conversion failed reason %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
     cSource = cBuf;
     cSourceLimit =cTarget;
@@ -4511,7 +4559,7 @@ TestISO_2022_CN() {
     ucnv_toUnicode(cnv,&uTarget,uTargetLimit,&cSource,cSourceLimit,myOff,TRUE,&errorCode);
     if(U_FAILURE(errorCode)){
         log_err("ucnv_toUnicode conversion failed reason %s\n", u_errorName(errorCode));
-        return;
+        goto cleanup;
     }
     uSource = (const UChar*)in;
     while(uSource<uSourceLimit){
@@ -4525,9 +4573,9 @@ TestISO_2022_CN() {
         test++;
     }
     TestGetNextUChar2022(cnv, cBuf, cTarget, in, "ISO-2022-CN encoding");
-    TestSmallTargetBuffer(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
-    TestSmallSourceBuffer(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
-    TestToAndFromUChars(in,(const UChar*)in + (sizeof(in)/sizeof(in[0])),cnv);
+    TestSmallTargetBuffer(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
+    TestSmallSourceBuffer(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
+    TestToAndFromUChars(in,(const UChar*)in + UPRV_LENGTHOF(in),cnv);
     TestJitterbug930("csISO2022CN");
     /*Test for the condition where there is an invalid character*/
     ucnv_reset(cnv);
@@ -4536,6 +4584,7 @@ TestISO_2022_CN() {
         TestNextUCharError(cnv, (const char*)source2, (const char*)source2+sizeof(source2), U_ZERO_ERROR, "an invalid character [ISO-2022-CN]");
     }
 
+cleanup:
     ucnv_close(cnv);
     free(uBuf);
     free(cBuf);
@@ -4552,6 +4601,10 @@ typedef struct {
 /* Callback for TestJitterbug6175, should only get called for empty segment errors */
 static void UCNV_TO_U_CALLBACK_EMPTYSEGMENT( const void *context, UConverterToUnicodeArgs *toArgs, const char* codeUnits,
                                              int32_t length, UConverterCallbackReason reason, UErrorCode * err ) {
+    // suppress compiler warnings about unused variables
+    (void)context;
+    (void)codeUnits;
+    (void)length;
     if (reason > UCNV_IRREGULAR) {
         return;
     }
@@ -4891,14 +4944,14 @@ TestLMBCS() {
 
        UChar Out [sizeof(pszUnicode) + 1];
        UChar * pOut = Out;
-       UChar * OutLimit = Out + sizeof(pszUnicode)/sizeof(UChar);
+       UChar * OutLimit = Out + UPRV_LENGTHOF(pszUnicode);
 
        int32_t off [sizeof(offsets)];
 
       /* last 'offset' in expected results is just the final size.
          (Makes other tests easier). Compensate here: */
 
-       off[(sizeof(offsets)/sizeof(offsets[0]))-1] = sizeof(pszLMBCS);
+       off[UPRV_LENGTHOF(offsets)-1] = sizeof(pszLMBCS);
 
 
 
@@ -4981,8 +5034,8 @@ TestLMBCS() {
 
       /* 0192 (hook) converts to both group 3 & group 1. input locale should differentiate */
       ucnv_fromUnicode (cnv16he,
-                        &pLMBCSIn, (pLMBCSIn + sizeof(lmbcsString)/sizeof(lmbcsString[0])),
-                        &pUniOut, pUniOut + sizeof(uniString)/sizeof(uniString[0]),
+                        &pLMBCSIn, (pLMBCSIn + UPRV_LENGTHOF(lmbcsString)),
+                        &pUniOut, pUniOut + UPRV_LENGTHOF(uniString),
                         NULL, 1, &errorCode);
 
       if (lmbcsString[0] != 0x3 || lmbcsString[1] != 0x83)
@@ -4993,8 +5046,8 @@ TestLMBCS() {
       pLMBCSIn= (char *)lmbcsString;
       pUniOut = uniString;
       ucnv_fromUnicode (cnv01us,
-                        &pLMBCSIn, (const char *)(lmbcsString + sizeof(lmbcsString)/sizeof(lmbcsString[0])),
-                        &pUniOut, pUniOut + sizeof(uniString)/sizeof(uniString[0]),
+                        &pLMBCSIn, (const char *)(lmbcsString + UPRV_LENGTHOF(lmbcsString)),
+                        &pUniOut, pUniOut + UPRV_LENGTHOF(uniString),
                         NULL, 1, &errorCode);
 
       if (lmbcsString[0] != 0x9F)
@@ -5061,7 +5114,7 @@ TestLMBCS() {
 
        UChar Out [sizeof(pszUnicode) + 1];
        UChar * pOut = Out;
-       UChar * OutLimit = Out + sizeof(pszUnicode)/sizeof(UChar);
+       UChar * OutLimit = Out + UPRV_LENGTHOF(pszUnicode);
 
 
        cnv = ucnv_open(NAME_LMBCS_1, &errorCode);
@@ -5170,7 +5223,7 @@ TestLMBCS() {
          /* running out of target room : U_BUFFER_OVERFLOW_ERROR */
 
          pUIn = pszUnicode;
-         ucnv_fromUnicode(cnv, &pLOut,pLOut+offsets[4],&pUIn,pUIn+sizeof(pszUnicode)/sizeof(UChar),off,FALSE, &errorCode);
+         ucnv_fromUnicode(cnv, &pLOut,pLOut+offsets[4],&pUIn,pUIn+UPRV_LENGTHOF(pszUnicode),off,FALSE, &errorCode);
          if (errorCode != U_BUFFER_OVERFLOW_ERROR || pLOut != LOut + offsets[4] || pUIn != pszUnicode+4 )
          {
             log_err("Unexpected results on out of target room to ucnv_fromUnicode\n");
@@ -5198,7 +5251,7 @@ TestLMBCS() {
          pUOut = UOut;
 
          ucnv_setToUCallBack(cnv, UCNV_TO_U_CALLBACK_STOP, NULL, NULL, NULL, &errorCode);
-         ucnv_toUnicode(cnv, &pUOut,pUOut+sizeof(UOut)/sizeof(UChar),(const char **)&pLIn,(const char *)(pLIn+5),off,TRUE, &errorCode);
+         ucnv_toUnicode(cnv, &pUOut,pUOut+UPRV_LENGTHOF(UOut),(const char **)&pLIn,(const char *)(pLIn+5),off,TRUE, &errorCode);
          if (UOut[0] != 0xD801 || errorCode != U_TRUNCATED_CHAR_FOUND || pUOut != UOut + 1 || pLIn != LIn + 5)
          {
             log_err("Unexpected results on chopped low surrogate\n");
@@ -5212,7 +5265,7 @@ TestLMBCS() {
          errorCode = U_ZERO_ERROR;
          pUOut = UOut;
 
-         ucnv_toUnicode(cnv, &pUOut,pUOut+sizeof(UOut)/sizeof(UChar),(const char **)&pLIn,(const char *)(pLIn+3),off,TRUE, &errorCode);
+         ucnv_toUnicode(cnv, &pUOut,pUOut+UPRV_LENGTHOF(UOut),(const char **)&pLIn,(const char *)(pLIn+3),off,TRUE, &errorCode);
          if (UOut[0] != 0xD801 || U_FAILURE(errorCode) || pUOut != UOut + 1 || pLIn != LIn + 3)
          {
             log_err("Unexpected results on chopped at surrogate boundary \n");
@@ -5229,7 +5282,7 @@ TestLMBCS() {
          errorCode = U_ZERO_ERROR;
          pUOut = UOut;
 
-         ucnv_toUnicode(cnv, &pUOut,pUOut+sizeof(UOut)/sizeof(UChar),(const char **)&pLIn,(const char *)(pLIn+6),off,TRUE, &errorCode);
+         ucnv_toUnicode(cnv, &pUOut,pUOut+UPRV_LENGTHOF(UOut),(const char **)&pLIn,(const char *)(pLIn+6),off,TRUE, &errorCode);
          if (UOut[0] != 0xD801 || UOut[1] != 0xC9D0 || U_FAILURE(errorCode) || pUOut != UOut + 2 || pLIn != LIn + 6)
          {
             log_err("Unexpected results after unpaired surrogate plus valid Unichar \n");
@@ -5246,7 +5299,7 @@ TestLMBCS() {
          errorCode = U_ZERO_ERROR;
          pUOut = UOut;
 
-         ucnv_toUnicode(cnv, &pUOut,pUOut+sizeof(UOut)/sizeof(UChar),(const char **)&pLIn,(const char *)(pLIn+5),off,TRUE, &errorCode);
+         ucnv_toUnicode(cnv, &pUOut,pUOut+UPRV_LENGTHOF(UOut),(const char **)&pLIn,(const char *)(pLIn+5),off,TRUE, &errorCode);
          if (UOut[0] != 0xD801 || errorCode != U_TRUNCATED_CHAR_FOUND || pUOut != UOut + 1 || pLIn != LIn + 5)
          {
             log_err("Unexpected results after unpaired surrogate plus chopped Unichar \n");
@@ -5263,7 +5316,7 @@ TestLMBCS() {
          errorCode = U_ZERO_ERROR;
          pUOut = UOut;
 
-         ucnv_toUnicode(cnv, &pUOut,pUOut+sizeof(UOut)/sizeof(UChar),(const char **)&pLIn,(const char *)(pLIn+5),off,TRUE, &errorCode);
+         ucnv_toUnicode(cnv, &pUOut,pUOut+UPRV_LENGTHOF(UOut),(const char **)&pLIn,(const char *)(pLIn+5),off,TRUE, &errorCode);
          if (UOut[0] != 0xD801 || UOut[1] != 0x1B || U_FAILURE(errorCode) || pUOut != UOut + 2 || pLIn != LIn + 5)
          {
             log_err("Unexpected results after unpaired surrogate plus valid non-Unichar\n");
@@ -5279,7 +5332,7 @@ TestLMBCS() {
          errorCode = U_ZERO_ERROR;
          pUOut = UOut;
 
-         ucnv_toUnicode(cnv, &pUOut,pUOut+sizeof(UOut)/sizeof(UChar),(const char **)&pLIn,(const char *)(pLIn+4),off,TRUE, &errorCode);
+         ucnv_toUnicode(cnv, &pUOut,pUOut+UPRV_LENGTHOF(UOut),(const char **)&pLIn,(const char *)(pLIn+4),off,TRUE, &errorCode);
 
          if (UOut[0] != 0xD801 || errorCode != U_TRUNCATED_CHAR_FOUND || pUOut != UOut + 1 || pLIn != LIn + 4)
          {
@@ -5378,6 +5431,12 @@ static void TestJitterbug981(){
     }
 
     rules = ucol_getRules(myCollator, &rules_length);
+    if(rules_length == 0) {
+        log_data_err("missing zh tailoring rule string\n");
+        ucol_close(myCollator);
+        ucnv_close(utf8cnv);
+        return;
+    }
     buff_size = rules_length * ucnv_getMaxCharSize(utf8cnv);
     buff = malloc(buff_size);
 
@@ -5405,6 +5464,7 @@ static void TestJitterbug981(){
 
 #endif
 
+#if !UCONFIG_NO_LEGACY_CONVERSION
 static void TestJitterbug1293(){
     static const UChar src[] = {0x30DE, 0x30A4, 0x5E83, 0x544A, 0x30BF, 0x30A4, 0x30D7,0x000};
     char target[256];
@@ -5432,6 +5492,8 @@ static void TestJitterbug1293(){
     }
     ucnv_close(conv);
 }
+#endif
+
 static void TestJB5275_1(){
 
     static const char* data = "\x3B\xB3\x0A" /* Easy characters */
@@ -5469,7 +5531,7 @@ static void TestJB5275_1(){
     }
     targetLimit = target;
     target = dest;
-    printUSeq(target, targetLimit-target);
+    printUSeq(target, (int)(targetLimit-target));
     while(target<targetLimit){
         if(*exp!=*target){
             log_err("did not get the expected output. \\u%04X != \\u%04X (got)\n", *exp, *target);
@@ -5511,12 +5573,12 @@ static void TestJB5275(){
     const UChar* exp = expected;
     ucnv_toUnicode(conv, &target, targetLimit, &source, sourceLimit, NULL, TRUE, &status);
     if(U_FAILURE(status)){
-        log_err("conversion failed: %s \n", u_errorName(status));
+        log_data_err("conversion failed: %s \n", u_errorName(status));
     }
     targetLimit = target;
     target = dest;
 
-    printUSeq(target, targetLimit-target);
+    printUSeq(target, (int)(targetLimit-target));
     
     while(target<targetLimit){
         if(*exp!=*target){
@@ -5527,3 +5589,49 @@ static void TestJB5275(){
     }
     ucnv_close(conv);
 }
+
+static void
+TestIsFixedWidth() {
+    UErrorCode status = U_ZERO_ERROR;
+    UConverter *cnv = NULL;
+    int32_t i;
+
+    const char *fixedWidth[] = {
+            "US-ASCII",
+            "UTF32",
+            "ibm-5478_P100-1995"
+    };
+
+    const char *notFixedWidth[] = {
+            "GB18030",
+            "UTF8",
+            "windows-949-2000",
+            "UTF16"
+    };
+
+    for (i = 0; i < UPRV_LENGTHOF(fixedWidth); i++) {
+        cnv = ucnv_open(fixedWidth[i], &status);
+        if (cnv == NULL || U_FAILURE(status)) {
+            log_data_err("Error open converter: %s - %s \n", fixedWidth[i], u_errorName(status));
+            continue;
+        }
+
+        if (!ucnv_isFixedWidth(cnv, &status)) {
+            log_err("%s is a fixedWidth converter but returned FALSE.\n", fixedWidth[i]);
+        }
+        ucnv_close(cnv);
+    }
+
+    for (i = 0; i < UPRV_LENGTHOF(notFixedWidth); i++) {
+        cnv = ucnv_open(notFixedWidth[i], &status);
+        if (cnv == NULL || U_FAILURE(status)) {
+            log_data_err("Error open converter: %s - %s \n", notFixedWidth[i], u_errorName(status));
+            continue;
+        }
+
+        if (ucnv_isFixedWidth(cnv, &status)) {
+            log_err("%s is NOT a fixedWidth converter but returned TRUE.\n", notFixedWidth[i]);
+        }
+        ucnv_close(cnv);
+    }
+}