]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/test/cintltst/nccbtst.c
ICU-551.51.4.tar.gz
[apple/icu.git] / icuSources / test / cintltst / nccbtst.c
index 669e88fd8cc28cd7f2c0dd1b070e9504d07b7c8c..c15ac6dd196d0b9eef78f322cbff55d6d5fbb8e2 100644 (file)
@@ -1,15 +1,16 @@
 /********************************************************************
  * COPYRIGHT: 
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2003, International Business Machines Corporation and
+ * Copyright (c) 1997-2013, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 /*
  * others. All Rights Reserved.
  ********************************************************************/
 /*
+********************************************************************************
 * File NCCBTST.C
 *
 * Modification History:
 *        Name                            Description
 *    Madhu Katragadda     7/21/1999      Testing error callback routines
 * File NCCBTST.C
 *
 * Modification History:
 *        Name                            Description
 *    Madhu Katragadda     7/21/1999      Testing error callback routines
-**************************************************************************************
+********************************************************************************
 */
 #include <stdio.h>
 #include <stdlib.h>
 */
 #include <stdio.h>
 #include <stdlib.h>
@@ -23,6 +24,9 @@
 #include "unicode/utypes.h"
 #include "unicode/ustring.h"
 #include "nccbtst.h"
 #include "unicode/utypes.h"
 #include "unicode/ustring.h"
 #include "nccbtst.h"
+#include "unicode/ucnv_cb.h"
+#include "unicode/utf16.h"
+
 #define NEW_MAX_BUFFER 999
 
 #define nct_min(x,y)  ((x<y) ? x : y)
 #define NEW_MAX_BUFFER 999
 
 #define nct_min(x,y)  ((x<y) ? x : y)
@@ -73,11 +77,13 @@ static void setNuConvTestName(const char *codepage, const char *direction)
     sprintf(gNuConvTestName, "[testing %s %s Unicode, InputBufSiz=%d, OutputBufSiz=%d]",
             codepage,
             direction,
     sprintf(gNuConvTestName, "[testing %s %s Unicode, InputBufSiz=%d, OutputBufSiz=%d]",
             codepage,
             direction,
-            gInBufferSize,
-            gOutBufferSize);
+            (int)gInBufferSize,
+            (int)gOutBufferSize);
 }
 
 
 }
 
 
+static void TestCallBackFailure(void);
+
 void addTestConvertErrorCallBack(TestNode** root);
 
 void addTestConvertErrorCallBack(TestNode** root)
 void addTestConvertErrorCallBack(TestNode** root);
 
 void addTestConvertErrorCallBack(TestNode** root)
@@ -86,8 +92,13 @@ void addTestConvertErrorCallBack(TestNode** root)
     addTest(root, &TestStopCallBack,  "tsconv/nccbtst/TestStopCallBack");
     addTest(root, &TestSubCallBack,   "tsconv/nccbtst/TestSubCallBack");
     addTest(root, &TestSubWithValueCallBack, "tsconv/nccbtst/TestSubWithValueCallBack");
     addTest(root, &TestStopCallBack,  "tsconv/nccbtst/TestStopCallBack");
     addTest(root, &TestSubCallBack,   "tsconv/nccbtst/TestSubCallBack");
     addTest(root, &TestSubWithValueCallBack, "tsconv/nccbtst/TestSubWithValueCallBack");
+
+#if !UCONFIG_NO_LEGACY_CONVERSION
     addTest(root, &TestLegalAndOtherCallBack,  "tsconv/nccbtst/TestLegalAndOtherCallBack");
     addTest(root, &TestSingleByteCallBack,  "tsconv/nccbtst/TestSingleByteCallBack");
     addTest(root, &TestLegalAndOtherCallBack,  "tsconv/nccbtst/TestLegalAndOtherCallBack");
     addTest(root, &TestSingleByteCallBack,  "tsconv/nccbtst/TestSingleByteCallBack");
+#endif
+
+    addTest(root, &TestCallBackFailure,  "tsconv/nccbtst/TestCallBackFailure");
 }
 
 static void TestSkipCallBack()
 }
 
 static void TestSkipCallBack()
@@ -112,12 +123,13 @@ static void TestSubCallBack()
     TestSub(1,NEW_MAX_BUFFER);
     TestSub(1,1);
     TestSub(NEW_MAX_BUFFER, 1);
     TestSub(1,NEW_MAX_BUFFER);
     TestSub(1,1);
     TestSub(NEW_MAX_BUFFER, 1);
+
+#if !UCONFIG_NO_LEGACY_CONVERSION
     TestEBCDIC_STATEFUL_Sub(1, 1);
     TestEBCDIC_STATEFUL_Sub(1, NEW_MAX_BUFFER);
     TestEBCDIC_STATEFUL_Sub(NEW_MAX_BUFFER, 1);
     TestEBCDIC_STATEFUL_Sub(NEW_MAX_BUFFER, NEW_MAX_BUFFER);
     TestEBCDIC_STATEFUL_Sub(1, 1);
     TestEBCDIC_STATEFUL_Sub(1, NEW_MAX_BUFFER);
     TestEBCDIC_STATEFUL_Sub(NEW_MAX_BUFFER, 1);
     TestEBCDIC_STATEFUL_Sub(NEW_MAX_BUFFER, NEW_MAX_BUFFER);
-
-
+#endif
 }
 
 static void TestSubWithValueCallBack()
 }
 
 static void TestSubWithValueCallBack()
@@ -128,6 +140,7 @@ static void TestSubWithValueCallBack()
     TestSubWithValue(NEW_MAX_BUFFER, 1);
 }
 
     TestSubWithValue(NEW_MAX_BUFFER, 1);
 }
 
+#if !UCONFIG_NO_LEGACY_CONVERSION
 static void TestLegalAndOtherCallBack()
 {
     TestLegalAndOthers(NEW_MAX_BUFFER, NEW_MAX_BUFFER);
 static void TestLegalAndOtherCallBack()
 {
     TestLegalAndOthers(NEW_MAX_BUFFER, NEW_MAX_BUFFER);
@@ -143,6 +156,7 @@ static void TestSingleByteCallBack()
     TestSingleByte(1,1);
     TestSingleByte(NEW_MAX_BUFFER, 1);
 }
     TestSingleByte(1,1);
     TestSingleByte(NEW_MAX_BUFFER, 1);
 }
+#endif
 
 static void TestSkip(int32_t inputsize, int32_t outputsize)
 {
 
 static void TestSkip(int32_t inputsize, int32_t outputsize)
 {
@@ -161,13 +175,13 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
     /*From Unicode*/
     log_verbose("Testing fromUnicode with UCNV_FROM_U_CALLBACK_SKIP  \n");
 
     /*From Unicode*/
     log_verbose("Testing fromUnicode with UCNV_FROM_U_CALLBACK_SKIP  \n");
 
+#if !UCONFIG_NO_LEGACY_CONVERSION
     {
         static const UChar   sampleText[] =  { 0x0000, 0xAC00, 0xAC01, 0xEF67, 0xD700 };
         static const UChar  sampleText2[] =  { 0x6D63, 0x6D64, 0x6D65, 0x6D66 };
 
         static const int32_t  toIBM949Offsskip [] = { 0, 1, 1, 2, 2, 4, 4 };
         static const int32_t  toIBM943Offsskip [] = { 0, 0, 1, 1, 3, 3 };
     {
         static const UChar   sampleText[] =  { 0x0000, 0xAC00, 0xAC01, 0xEF67, 0xD700 };
         static const UChar  sampleText2[] =  { 0x6D63, 0x6D64, 0x6D65, 0x6D66 };
 
         static const int32_t  toIBM949Offsskip [] = { 0, 1, 1, 2, 2, 4, 4 };
         static const int32_t  toIBM943Offsskip [] = { 0, 0, 1, 1, 3, 3 };
-        static const int32_t  toIBM930Offsskip [] = { 0, 0, 0, 1, 1, 3, 3, 3 };
 
         if(!testConvertFromUnicode(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
                 expskipIBM_949, sizeof(expskipIBM_949), "ibm-949",
 
         if(!testConvertFromUnicode(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
                 expskipIBM_949, sizeof(expskipIBM_949), "ibm-949",
@@ -177,15 +191,6 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
                 expskipIBM_943, sizeof(expskipIBM_943), "ibm-943",
                 UCNV_FROM_U_CALLBACK_SKIP, toIBM943Offsskip, NULL, 0 ))
             log_err("u-> ibm-943 with skip did not match.\n");
                 expskipIBM_943, sizeof(expskipIBM_943), "ibm-943",
                 UCNV_FROM_U_CALLBACK_SKIP, toIBM943Offsskip, NULL, 0 ))
             log_err("u-> ibm-943 with skip did not match.\n");
-        if(!testConvertFromUnicode(sampleText2, sizeof(sampleText2)/sizeof(sampleText2[0]),
-                expskipIBM_930, sizeof(expskipIBM_930), "ibm-930",
-                UCNV_FROM_U_CALLBACK_SKIP, toIBM930Offsskip , NULL, 0))
-            log_err("u-> ibm-930 with skip did not match.\n");
-    
-        if(!testConvertFromUnicodeWithContext(sampleText2, sizeof(sampleText2)/sizeof(sampleText2[0]),
-                expskipIBM_930, sizeof(expskipIBM_930), "ibm-930",
-                UCNV_FROM_U_CALLBACK_SKIP, toIBM930Offsskip , NULL, 0,"i", U_ILLEGAL_CHAR_FOUND))
-            log_err("u-> ibm-930 with skip did not match.\n");
     }
 
     {
     }
 
     {
@@ -203,6 +208,7 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
             log_err("u->ibm-930 with skip with untaken fallbacks did not match.\n");
         }
     }
             log_err("u->ibm-930 with skip with untaken fallbacks did not match.\n");
         }
     }
+#endif
 
     {
         static const UChar usasciiFromU[] = { 0x61, 0x80, 0x4e00, 0x31, 0xd800, 0xdfff, 0x39 };
 
     {
         static const UChar usasciiFromU[] = { 0x61, 0x80, 0x4e00, 0x31, 0xd800, 0xdfff, 0x39 };
@@ -223,6 +229,7 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
             log_err("u->US-ASCII with skip did not match.\n");
         }
 
             log_err("u->US-ASCII with skip did not match.\n");
         }
 
+#if !UCONFIG_NO_LEGACY_CONVERSION
         /* SBCS NLTC codepage 367 for US-ASCII */
         if(!testConvertFromUnicode(usasciiFromU, sizeof(usasciiFromU)/U_SIZEOF_UCHAR,
                                    usasciiFromUBytes, sizeof(usasciiFromUBytes),
         /* SBCS NLTC codepage 367 for US-ASCII */
         if(!testConvertFromUnicode(usasciiFromU, sizeof(usasciiFromU)/U_SIZEOF_UCHAR,
                                    usasciiFromUBytes, sizeof(usasciiFromUBytes),
@@ -232,6 +239,7 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
         ) {
             log_err("u->ibm-367 with skip did not match.\n");
         }
         ) {
             log_err("u->ibm-367 with skip did not match.\n");
         }
+#endif
 
         /* ISO-Latin-1 */
         if(!testConvertFromUnicode(latin1FromU, sizeof(latin1FromU)/U_SIZEOF_UCHAR,
 
         /* ISO-Latin-1 */
         if(!testConvertFromUnicode(latin1FromU, sizeof(latin1FromU)/U_SIZEOF_UCHAR,
@@ -243,6 +251,7 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
             log_err("u->LATIN_1 with skip did not match.\n");
         }
 
             log_err("u->LATIN_1 with skip did not match.\n");
         }
 
+#if !UCONFIG_NO_LEGACY_CONVERSION
         /* windows-1252 */
         if(!testConvertFromUnicode(latin1FromU, sizeof(latin1FromU)/U_SIZEOF_UCHAR,
                                    latin1FromUBytes, sizeof(latin1FromUBytes),
         /* windows-1252 */
         if(!testConvertFromUnicode(latin1FromU, sizeof(latin1FromU)/U_SIZEOF_UCHAR,
                                    latin1FromUBytes, sizeof(latin1FromUBytes),
@@ -283,14 +292,6 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
         };
         static const int32_t from_iso_2022_jpOffs [] ={0,2};
 
         };
         static const int32_t from_iso_2022_jpOffs [] ={0,2};
 
-        static const UChar iso_2022_jp_inputText1[]={0x3000, 0x00E9, 0x3001, };
-        static const uint8_t to_iso_2022_jp1[]={ 
-            0x1b,   0x24,   0x42,   0x21, 0x21,       
-            0x21,   0x22,
-
-        };
-        static const int32_t from_iso_2022_jpOffs1 [] ={0,0,0,0,0,2,2,};
-
         /*ISO-2022-JP*/
         UChar const iso_2022_jp_inputText2[]={0x0041, 0x00E9/*unassigned*/,0x43,0xd800/*illegal*/,0x0042, };
         static const uint8_t to_iso_2022_jp2[]={ 
         /*ISO-2022-JP*/
         UChar const iso_2022_jp_inputText2[]={0x0041, 0x00E9/*unassigned*/,0x43,0xd800/*illegal*/,0x0042, };
         static const uint8_t to_iso_2022_jp2[]={ 
@@ -303,22 +304,19 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
         /*ISO-2022-cn*/
         static const UChar iso_2022_cn_inputText[]={ 0x0041, 0x3712/*unassigned*/, 0x0042, };
         static const uint8_t to_iso_2022_cn[]={  
         /*ISO-2022-cn*/
         static const UChar iso_2022_cn_inputText[]={ 0x0041, 0x3712/*unassigned*/, 0x0042, };
         static const uint8_t to_iso_2022_cn[]={  
-            0x0F,   0x41,   
-            0x0F,   0x42, 
+            0x41, 0x42
         };
         static const int32_t from_iso_2022_cnOffs [] ={ 
         };
         static const int32_t from_iso_2022_cnOffs [] ={ 
-            0,0,
-            2,2,
+            0, 2
         };
         
         /*ISO-2022-CN*/
         static const UChar iso_2022_cn_inputText1[]={0x0041, 0x3712/*unassigned*/,0x43,0xd800/*illegal*/,0x0042, };
         static const uint8_t to_iso_2022_cn1[]={ 
         };
         
         /*ISO-2022-CN*/
         static const UChar iso_2022_cn_inputText1[]={0x0041, 0x3712/*unassigned*/,0x43,0xd800/*illegal*/,0x0042, };
         static const uint8_t to_iso_2022_cn1[]={ 
-            0x0F,   0x41,   
-            0x0F,   0x43, 
+            0x41, 0x43
 
         };
 
         };
-        static const int32_t from_iso_2022_cnOffs1 [] ={0,0,2,2};
+        static const int32_t from_iso_2022_cnOffs1 [] ={ 0, 2 };
 
         /*ISO-2022-kr*/
         static const UChar iso_2022_kr_inputText[]={ 0x0041, 0x03A0,0x3712/*unassigned*/,0x03A0, 0x0042, };
 
         /*ISO-2022-kr*/
         static const UChar iso_2022_kr_inputText[]={ 0x0041, 0x03A0,0x3712/*unassigned*/,0x03A0, 0x0042, };
@@ -386,6 +384,7 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
 
         };
 
 
         };
 
+#endif
 
         static const UChar SCSU_inputText[]={ 0x0041, 0xd801/*illegal*/, 0x0042, };
 
 
         static const UChar SCSU_inputText[]={ 0x0041, 0xd801/*illegal*/, 0x0042, };
 
@@ -400,6 +399,8 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
             2,
 
         };
             2,
 
         };
+
+#if !UCONFIG_NO_LEGACY_CONVERSION
         /* ISCII */
         static const UChar iscii_inputText[]={ 0x0041, 0x3712/*unassigned*/, 0x0042, };
         static const uint8_t to_iscii[]={  
         /* ISCII */
         static const UChar iscii_inputText[]={ 0x0041, 0x3712/*unassigned*/, 0x0042, };
         static const uint8_t to_iscii[]={  
@@ -425,7 +426,7 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
             log_err("u-> ibm-943 with skip did not match.\n");
 
         if(!testConvertFromUnicode(euc_jp_inputText, sizeof(euc_jp_inputText)/sizeof(euc_jp_inputText[0]),
             log_err("u-> ibm-943 with skip did not match.\n");
 
         if(!testConvertFromUnicode(euc_jp_inputText, sizeof(euc_jp_inputText)/sizeof(euc_jp_inputText[0]),
-                to_euc_jp, sizeof(to_euc_jp), "euc-jp",
+                to_euc_jp, sizeof(to_euc_jp), "IBM-eucJP",
                 UCNV_FROM_U_CALLBACK_SKIP, fromEUC_JPOffs, NULL, 0 ))
             log_err("u-> euc-jp with skip did not match.\n");
 
                 UCNV_FROM_U_CALLBACK_SKIP, fromEUC_JPOffs, NULL, 0 ))
             log_err("u-> euc-jp with skip did not match.\n");
 
@@ -440,10 +441,6 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
                 UCNV_FROM_U_CALLBACK_SKIP, from_iso_2022_jpOffs, NULL, 0 ))
             log_err("u-> iso-2022-jp with skip did not match.\n"); 
         
                 UCNV_FROM_U_CALLBACK_SKIP, from_iso_2022_jpOffs, NULL, 0 ))
             log_err("u-> iso-2022-jp with skip did not match.\n"); 
         
-        if(!testConvertFromUnicode(iso_2022_jp_inputText1, sizeof(iso_2022_jp_inputText1)/sizeof(iso_2022_jp_inputText1[0]),
-                to_iso_2022_jp1, sizeof(to_iso_2022_jp1), "iso-2022-jp",
-                UCNV_FROM_U_CALLBACK_SKIP, from_iso_2022_jpOffs1, NULL, 0 ))
-            log_err("u-> iso-2022-jp with skip did not match.\n"); 
         /* with context */
         if(!testConvertFromUnicodeWithContext(iso_2022_jp_inputText2, sizeof(iso_2022_jp_inputText2)/sizeof(iso_2022_jp_inputText2[0]),
                 to_iso_2022_jp2, sizeof(to_iso_2022_jp2), "iso-2022-jp",
         /* with context */
         if(!testConvertFromUnicodeWithContext(iso_2022_jp_inputText2, sizeof(iso_2022_jp_inputText2)/sizeof(iso_2022_jp_inputText2[0]),
                 to_iso_2022_jp2, sizeof(to_iso_2022_jp2), "iso-2022-jp",
@@ -481,7 +478,8 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
         if(!testConvertFromUnicodeWithContext(hz_inputText1, sizeof(hz_inputText1)/sizeof(hz_inputText1[0]),
                 to_hz1, sizeof(to_hz1), "hz",
                 UCNV_FROM_U_CALLBACK_SKIP, from_hzOffs1, NULL, 0,UCNV_SKIP_STOP_ON_ILLEGAL,U_ILLEGAL_CHAR_FOUND ))
         if(!testConvertFromUnicodeWithContext(hz_inputText1, sizeof(hz_inputText1)/sizeof(hz_inputText1[0]),
                 to_hz1, sizeof(to_hz1), "hz",
                 UCNV_FROM_U_CALLBACK_SKIP, from_hzOffs1, NULL, 0,UCNV_SKIP_STOP_ON_ILLEGAL,U_ILLEGAL_CHAR_FOUND ))
-            log_err("u-> hz with skip & UCNV_SKIP_STOP_ON_ILLEGAL did not match.\n"); 
+            log_err("u-> hz with skip & UCNV_SKIP_STOP_ON_ILLEGAL did not match.\n");
+#endif
         
         /*SCSU*/
         if(!testConvertFromUnicode(SCSU_inputText, sizeof(SCSU_inputText)/sizeof(SCSU_inputText[0]),
         
         /*SCSU*/
         if(!testConvertFromUnicode(SCSU_inputText, sizeof(SCSU_inputText)/sizeof(SCSU_inputText[0]),
@@ -489,6 +487,7 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
                 UCNV_FROM_U_CALLBACK_SKIP, from_SCSUOffs, NULL, 0 ))
             log_err("u-> SCSU with skip did not match.\n");
 
                 UCNV_FROM_U_CALLBACK_SKIP, from_SCSUOffs, NULL, 0 ))
             log_err("u-> SCSU with skip did not match.\n");
 
+#if !UCONFIG_NO_LEGACY_CONVERSION
         /*ISCII*/
         if(!testConvertFromUnicode(iscii_inputText, sizeof(iscii_inputText)/sizeof(iscii_inputText[0]),
                 to_iscii, sizeof(to_iscii), "ISCII,version=0",
         /*ISCII*/
         if(!testConvertFromUnicode(iscii_inputText, sizeof(iscii_inputText)/sizeof(iscii_inputText[0]),
                 to_iscii, sizeof(to_iscii), "ISCII,version=0",
@@ -499,7 +498,7 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
                 to_iscii1, sizeof(to_iscii1), "ISCII,version=0",
                 UCNV_FROM_U_CALLBACK_SKIP, from_isciiOffs1, NULL, 0,UCNV_SKIP_STOP_ON_ILLEGAL,U_ILLEGAL_CHAR_FOUND ))
             log_err("u-> iscii with skip & UCNV_SKIP_STOP_ON_ILLEGAL did not match.\n");
                 to_iscii1, sizeof(to_iscii1), "ISCII,version=0",
                 UCNV_FROM_U_CALLBACK_SKIP, from_isciiOffs1, NULL, 0,UCNV_SKIP_STOP_ON_ILLEGAL,U_ILLEGAL_CHAR_FOUND ))
             log_err("u-> iscii with skip & UCNV_SKIP_STOP_ON_ILLEGAL did not match.\n");
-      
+#endif     
     }
 
     log_verbose("Testing fromUnicode for BOCU-1 with UCNV_TO_U_CALLBACK_SKIP\n");
     }
 
     log_verbose("Testing fromUnicode for BOCU-1 with UCNV_TO_U_CALLBACK_SKIP\n");
@@ -650,6 +649,7 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
     /*to Unicode*/
     log_verbose("Testing toUnicode with UCNV_TO_U_CALLBACK_SKIP  \n");
 
     /*to Unicode*/
     log_verbose("Testing toUnicode with UCNV_TO_U_CALLBACK_SKIP  \n");
 
+#if !UCONFIG_NO_LEGACY_CONVERSION
     {
 
         static const UChar IBM_949skiptoUnicode[]= {0x0000, 0xAC00, 0xAC01, 0xD700 };
     {
 
         static const UChar IBM_949skiptoUnicode[]= {0x0000, 0xAC00, 0xAC01, 0xD700 };
@@ -681,6 +681,7 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
                 UCNV_TO_U_CALLBACK_SKIP, fromIBM930Offs, NULL, 0,"i",U_ILLEGAL_CHAR_FOUND ))
             log_err("ibm-930->u with skip did not match.\n");
     }
                 UCNV_TO_U_CALLBACK_SKIP, fromIBM930Offs, NULL, 0,"i",U_ILLEGAL_CHAR_FOUND ))
             log_err("ibm-930->u with skip did not match.\n");
     }
+#endif
 
     {
         static const uint8_t usasciiToUBytes[] = { 0x61, 0x80, 0x31 };
 
     {
         static const uint8_t usasciiToUBytes[] = { 0x61, 0x80, 0x31 };
@@ -701,6 +702,7 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
             log_err("US-ASCII->u with skip did not match.\n");
         }
 
             log_err("US-ASCII->u with skip did not match.\n");
         }
 
+#if !UCONFIG_NO_LEGACY_CONVERSION
         /* SBCS NLTC codepage 367 for US-ASCII */
         if(!testConvertToUnicode(usasciiToUBytes, sizeof(usasciiToUBytes),
                                  usasciiToU, sizeof(usasciiToU)/U_SIZEOF_UCHAR,
         /* SBCS NLTC codepage 367 for US-ASCII */
         if(!testConvertToUnicode(usasciiToUBytes, sizeof(usasciiToUBytes),
                                  usasciiToU, sizeof(usasciiToU)/U_SIZEOF_UCHAR,
@@ -710,6 +712,7 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
         ) {
             log_err("ibm-367->u with skip did not match.\n");
         }
         ) {
             log_err("ibm-367->u with skip did not match.\n");
         }
+#endif
 
         /* ISO-Latin-1 */
         if(!testConvertToUnicode(latin1ToUBytes, sizeof(latin1ToUBytes),
 
         /* ISO-Latin-1 */
         if(!testConvertToUnicode(latin1ToUBytes, sizeof(latin1ToUBytes),
@@ -721,6 +724,7 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
             log_err("LATIN_1->u with skip did not match.\n");
         }
 
             log_err("LATIN_1->u with skip did not match.\n");
         }
 
+#if !UCONFIG_NO_LEGACY_CONVERSION
         /* windows-1252 */
         if(!testConvertToUnicode(latin1ToUBytes, sizeof(latin1ToUBytes),
                                  latin1ToU, sizeof(latin1ToU)/U_SIZEOF_UCHAR,
         /* windows-1252 */
         if(!testConvertToUnicode(latin1ToUBytes, sizeof(latin1ToUBytes),
                                  latin1ToU, sizeof(latin1ToU)/U_SIZEOF_UCHAR,
@@ -730,8 +734,10 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
         ) {
             log_err("windows-1252->u with skip did not match.\n");
         }
         ) {
             log_err("windows-1252->u with skip did not match.\n");
         }
+#endif
     }
 
     }
 
+#if !UCONFIG_NO_LEGACY_CONVERSION
     {
         static const uint8_t sampleTxtEBCIDIC_STATEFUL [] ={
             0x0e, 0x5d, 0x5f , 0x41, 0x79, 0x41, 0x44
     {
         static const uint8_t sampleTxtEBCIDIC_STATEFUL [] ={
             0x0e, 0x5d, 0x5f , 0x41, 0x79, 0x41, 0x44
@@ -759,8 +765,8 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
                 /*iso-2022-jp*/
         static const uint8_t sampleTxt_iso_2022_jp[]={ 
             0x41,
                 /*iso-2022-jp*/
         static const uint8_t sampleTxt_iso_2022_jp[]={ 
             0x41,
-            0x1b,   0x24,   0x42,   0x2A, 0x44, /*unassigned*/
-             0x1b,   0x28,   0x42,   0x42,
+            0x1b,   0x24,   0x42,   0x3a, 0x1a, /*unassigned*/
+            0x1b,   0x28,   0x42,   0x42,
             
         };
         static const UChar iso_2022_jptoUnicode[]={    0x41,0x42 };
             
         };
         static const UChar iso_2022_jptoUnicode[]={    0x41,0x42 };
@@ -851,7 +857,7 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
         log_err("EBCIDIC_STATEFUL->u with skip did not match.\n");
 
         if(!testConvertToUnicode(sampleTxt_euc_jp, sizeof(sampleTxt_euc_jp),
         log_err("EBCIDIC_STATEFUL->u with skip did not match.\n");
 
         if(!testConvertToUnicode(sampleTxt_euc_jp, sizeof(sampleTxt_euc_jp),
-                 euc_jptoUnicode, sizeof(euc_jptoUnicode)/sizeof(euc_jptoUnicode[0]),"euc-jp",
+                 euc_jptoUnicode, sizeof(euc_jptoUnicode)/sizeof(euc_jptoUnicode[0]),"IBM-eucJP",
                 UCNV_TO_U_CALLBACK_SKIP, from_euc_jpOffs , NULL, 0))
             log_err("euc-jp->u with skip did not match.\n");
 
                 UCNV_TO_U_CALLBACK_SKIP, from_euc_jpOffs , NULL, 0))
             log_err("euc-jp->u with skip did not match.\n");
 
@@ -894,6 +900,8 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
             log_err("LMBCS->u with skip did not match.\n");
 
     }
             log_err("LMBCS->u with skip did not match.\n");
 
     }
+#endif
+
     log_verbose("Testing to Unicode for UTF-8 with UCNV_TO_U_CALLBACK_SKIP \n");
     {
         const uint8_t sampleText1[] = { 0x31, 0xe4, 0xba, 0x8c, 
     log_verbose("Testing to Unicode for UTF-8 with UCNV_TO_U_CALLBACK_SKIP \n");
     {
         const uint8_t sampleText1[] = { 0x31, 0xe4, 0xba, 0x8c, 
@@ -1093,7 +1101,10 @@ static void TestStop(int32_t inputsize, int32_t outputsize)
 
     gInBufferSize = inputsize;
     gOutBufferSize = outputsize;
 
     gInBufferSize = inputsize;
     gOutBufferSize = outputsize;
+
     /*From Unicode*/
     /*From Unicode*/
+
+#if !UCONFIG_NO_LEGACY_CONVERSION
     if(!testConvertFromUnicode(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
             expstopIBM_949, sizeof(expstopIBM_949), "ibm-949",
             UCNV_FROM_U_CALLBACK_STOP, toIBM949Offsstop, NULL, 0 ))
     if(!testConvertFromUnicode(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
             expstopIBM_949, sizeof(expstopIBM_949), "ibm-949",
             UCNV_FROM_U_CALLBACK_STOP, toIBM949Offsstop, NULL, 0 ))
@@ -1135,7 +1146,7 @@ static void TestStop(int32_t inputsize, int32_t outputsize)
         /*ISO-2022-cn*/
         static const UChar iso_2022_cn_inputText[]={ 0x0041, 0x3712, 0x0042, };
         static const uint8_t to_iso_2022_cn[]={  
         /*ISO-2022-cn*/
         static const UChar iso_2022_cn_inputText[]={ 0x0041, 0x3712, 0x0042, };
         static const uint8_t to_iso_2022_cn[]={  
-            0x0F,   0x41,   
+            0x41,   
 
         };
         static const int32_t from_iso_2022_cnOffs [] ={ 
 
         };
         static const int32_t from_iso_2022_cnOffs [] ={ 
@@ -1184,7 +1195,7 @@ static void TestStop(int32_t inputsize, int32_t outputsize)
             log_err("u-> ibm-943 with stop did not match.\n");
 
         if(!testConvertFromUnicode(euc_jp_inputText, sizeof(euc_jp_inputText)/sizeof(euc_jp_inputText[0]),
             log_err("u-> ibm-943 with stop did not match.\n");
 
         if(!testConvertFromUnicode(euc_jp_inputText, sizeof(euc_jp_inputText)/sizeof(euc_jp_inputText[0]),
-                to_euc_jp, sizeof(to_euc_jp), "euc-jp",
+                to_euc_jp, sizeof(to_euc_jp), "IBM-eucJP",
                 UCNV_FROM_U_CALLBACK_STOP, fromEUC_JPOffs, NULL, 0 ))
             log_err("u-> euc-jp with stop did not match.\n");
 
                 UCNV_FROM_U_CALLBACK_STOP, fromEUC_JPOffs, NULL, 0 ))
             log_err("u-> euc-jp with stop did not match.\n");
 
@@ -1225,6 +1236,8 @@ static void TestStop(int32_t inputsize, int32_t outputsize)
 
 
     }
 
 
     }
+#endif
+
     log_verbose("Testing fromUnicode for SCSU with UCNV_FROM_U_CALLBACK_STOP \n");
     {
         static const UChar SCSU_inputText[]={ 0x0041, 0xd801/*illegal*/, 0x0042, };
     log_verbose("Testing fromUnicode for SCSU with UCNV_FROM_U_CALLBACK_STOP \n");
     {
         static const UChar SCSU_inputText[]={ 0x0041, 0xd801/*illegal*/, 0x0042, };
@@ -1243,7 +1256,10 @@ static void TestStop(int32_t inputsize, int32_t outputsize)
             log_err("u-> SCSU with skip did not match.\n");
     
     }
             log_err("u-> SCSU with skip did not match.\n");
     
     }
+
     /*to Unicode*/
     /*to Unicode*/
+
+#if !UCONFIG_NO_LEGACY_CONVERSION
     if(!testConvertToUnicode(expstopIBM_949, sizeof(expstopIBM_949),
              IBM_949stoptoUnicode, sizeof(IBM_949stoptoUnicode)/sizeof(IBM_949stoptoUnicode[0]),"ibm-949",
             UCNV_TO_U_CALLBACK_STOP, fromIBM949Offs, NULL, 0 ))
     if(!testConvertToUnicode(expstopIBM_949, sizeof(expstopIBM_949),
              IBM_949stoptoUnicode, sizeof(IBM_949stoptoUnicode)/sizeof(IBM_949stoptoUnicode[0]),"ibm-949",
             UCNV_TO_U_CALLBACK_STOP, fromIBM949Offs, NULL, 0 ))
@@ -1291,7 +1307,7 @@ static void TestStop(int32_t inputsize, int32_t outputsize)
         log_err("EBCIDIC_STATEFUL->u with stop did not match.\n");
 
         if(!testConvertToUnicode(sampleTxt_euc_jp, sizeof(sampleTxt_euc_jp),
         log_err("EBCIDIC_STATEFUL->u with stop did not match.\n");
 
         if(!testConvertToUnicode(sampleTxt_euc_jp, sizeof(sampleTxt_euc_jp),
-             euc_jptoUnicode, sizeof(euc_jptoUnicode)/sizeof(euc_jptoUnicode[0]),"euc-jp",
+             euc_jptoUnicode, sizeof(euc_jptoUnicode)/sizeof(euc_jptoUnicode[0]),"IBM-eucJP",
             UCNV_TO_U_CALLBACK_STOP, from_euc_jpOffs , NULL, 0))
         log_err("euc-jp->u with stop did not match.\n");
 
             UCNV_TO_U_CALLBACK_STOP, from_euc_jpOffs , NULL, 0))
         log_err("euc-jp->u with stop did not match.\n");
 
@@ -1300,6 +1316,8 @@ static void TestStop(int32_t inputsize, int32_t outputsize)
                 UCNV_TO_U_CALLBACK_STOP, from_euc_twOffs, NULL, 0 ))
             log_err("euc-tw->u with stop did not match.\n");
     }
                 UCNV_TO_U_CALLBACK_STOP, from_euc_twOffs, NULL, 0 ))
             log_err("euc-tw->u with stop did not match.\n");
     }
+#endif
+
     log_verbose("Testing toUnicode for UTF-8 with UCNV_TO_U_CALLBACK_STOP \n");
     {
         static const uint8_t sampleText1[] = { 0x31, 0xe4, 0xba, 0x8c, 
     log_verbose("Testing toUnicode for UTF-8 with UCNV_TO_U_CALLBACK_STOP \n");
     {
         static const uint8_t sampleText1[] = { 0x31, 0xe4, 0xba, 0x8c, 
@@ -1356,6 +1374,8 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
     gOutBufferSize = outputsize;
 
     /*from unicode*/
     gOutBufferSize = outputsize;
 
     /*from unicode*/
+
+#if !UCONFIG_NO_LEGACY_CONVERSION
     if(!testConvertFromUnicode(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
             expsubIBM_949, sizeof(expsubIBM_949), "ibm-949", 
             UCNV_FROM_U_CALLBACK_SUBSTITUTE, toIBM949Offssub, NULL, 0 ))
     if(!testConvertFromUnicode(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
             expsubIBM_949, sizeof(expsubIBM_949), "ibm-949", 
             UCNV_FROM_U_CALLBACK_SUBSTITUTE, toIBM949Offssub, NULL, 0 ))
@@ -1392,24 +1412,6 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
             0x61, 0xe6, 0xca, 0x8a,
         };
 
             0x61, 0xe6, 0xca, 0x8a,
         };
 
-        /*ISO-2022-JP*/
-        static const UChar iso_2022_jp_inputText[]={ 0x0041, 0x00E9, 0x0042,0x00E9,0x3000 };
-        static const uint8_t to_iso_2022_jp[]={  
-               0x41,   
-               0x1a, 
-               0x42,
-               0x1a,
-               0x1b,  0x24,   0x42,   0x21,   0x21, 
-        };
-
-        static const int32_t from_iso_2022_jpOffs [] ={ 
-            0,
-            1,
-            2,
-            3,
-            4,4,4,4,4
-        };
-
         static const int32_t from_euc_twOffs [] ={ 0, 1, 1, 2, 2, 2, 2, 3, 3, 5, 5, 6, 7, 7, 8,};
 
         if(!testConvertFromUnicode(inputTest, sizeof(inputTest)/sizeof(inputTest[0]),
         static const int32_t from_euc_twOffs [] ={ 0, 1, 1, 2, 2, 2, 2, 3, 3, 5, 5, 6, 7, 7, 8,};
 
         if(!testConvertFromUnicode(inputTest, sizeof(inputTest)/sizeof(inputTest[0]),
@@ -1418,7 +1420,7 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
             log_err("u-> ibm-943 with substitute did not match.\n");
 
         if(!testConvertFromUnicode(euc_jp_inputText, sizeof(euc_jp_inputText)/sizeof(euc_jp_inputText[0]),
             log_err("u-> ibm-943 with substitute did not match.\n");
 
         if(!testConvertFromUnicode(euc_jp_inputText, sizeof(euc_jp_inputText)/sizeof(euc_jp_inputText[0]),
-                to_euc_jp, sizeof(to_euc_jp), "euc-jp",
+                to_euc_jp, sizeof(to_euc_jp), "IBM-eucJP",
                 UCNV_FROM_U_CALLBACK_SUBSTITUTE, fromEUC_JPOffs, NULL, 0 ))
             log_err("u-> euc-jp with substitute did not match.\n");
 
                 UCNV_FROM_U_CALLBACK_SUBSTITUTE, fromEUC_JPOffs, NULL, 0 ))
             log_err("u-> euc-jp with substitute did not match.\n");
 
@@ -1426,14 +1428,8 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
                 to_euc_tw, sizeof(to_euc_tw), "euc-tw",
                 UCNV_FROM_U_CALLBACK_SUBSTITUTE, from_euc_twOffs, NULL, 0 ))
             log_err("u-> euc-tw with substitute did not match.\n");
                 to_euc_tw, sizeof(to_euc_tw), "euc-tw",
                 UCNV_FROM_U_CALLBACK_SUBSTITUTE, from_euc_twOffs, NULL, 0 ))
             log_err("u-> euc-tw with substitute did not match.\n");
-
-        if(!testConvertFromUnicodeWithContext(iso_2022_jp_inputText, sizeof(iso_2022_jp_inputText)/sizeof(iso_2022_jp_inputText[0]),
-                to_iso_2022_jp, sizeof(to_iso_2022_jp), "iso-2022-jp",
-                UCNV_FROM_U_CALLBACK_SUBSTITUTE, from_iso_2022_jpOffs, NULL, 0,"i",U_ILLEGAL_CHAR_FOUND ))
-            log_err("u-> iso-2022-jp with substitute did not match.\n");
-        
-
     }
     }
+#endif
 
     log_verbose("Testing fromUnicode for SCSU with UCNV_FROM_U_CALLBACK_SUBSTITUTE \n");
     {
 
     log_verbose("Testing fromUnicode for SCSU with UCNV_FROM_U_CALLBACK_SUBSTITUTE \n");
     {
@@ -1543,6 +1539,8 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
     }
 
     /*to unicode*/
     }
 
     /*to unicode*/
+
+#if !UCONFIG_NO_LEGACY_CONVERSION
     if(!testConvertToUnicode(expsubIBM_949, sizeof(expsubIBM_949),
              IBM_949subtoUnicode, sizeof(IBM_949subtoUnicode)/sizeof(IBM_949subtoUnicode[0]),"ibm-949",
             UCNV_TO_U_CALLBACK_SUBSTITUTE, fromIBM949Offs, NULL, 0 ))
     if(!testConvertToUnicode(expsubIBM_949, sizeof(expsubIBM_949),
              IBM_949subtoUnicode, sizeof(IBM_949subtoUnicode)/sizeof(IBM_949subtoUnicode[0]),"ibm-949",
             UCNV_TO_U_CALLBACK_SUBSTITUTE, fromIBM949Offs, NULL, 0 ))
@@ -1592,7 +1590,7 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
 
 
         if(!testConvertToUnicode(sampleTxt_euc_jp, sizeof(sampleTxt_euc_jp),
 
 
         if(!testConvertToUnicode(sampleTxt_euc_jp, sizeof(sampleTxt_euc_jp),
-           euc_jptoUnicode, sizeof(euc_jptoUnicode)/sizeof(euc_jptoUnicode[0]),"euc-jp",
+           euc_jptoUnicode, sizeof(euc_jptoUnicode)/sizeof(euc_jptoUnicode[0]),"IBM-eucJP",
           UCNV_TO_U_CALLBACK_SUBSTITUTE, from_euc_jpOffs, NULL, 0 ))
             log_err("euc-jp->u with substitute did not match.\n");
 
           UCNV_TO_U_CALLBACK_SUBSTITUTE, from_euc_jpOffs, NULL, 0 ))
             log_err("euc-jp->u with substitute did not match.\n");
 
@@ -1604,13 +1602,12 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
 
         
         if(!testConvertToUnicodeWithContext(sampleTxt_euc_jp, sizeof(sampleTxt_euc_jp),
 
         
         if(!testConvertToUnicodeWithContext(sampleTxt_euc_jp, sizeof(sampleTxt_euc_jp),
-           euc_jptoUnicode, sizeof(euc_jptoUnicode)/sizeof(euc_jptoUnicode[0]),"euc-jp",
+           euc_jptoUnicode, sizeof(euc_jptoUnicode)/sizeof(euc_jptoUnicode[0]),"IBM-eucJP",
           UCNV_TO_U_CALLBACK_SUBSTITUTE, from_euc_jpOffs, NULL, 0 ,"i", U_ILLEGAL_CHAR_FOUND))
             log_err("euc-jp->u with substitute did not match.\n");
           UCNV_TO_U_CALLBACK_SUBSTITUTE, from_euc_jpOffs, NULL, 0 ,"i", U_ILLEGAL_CHAR_FOUND))
             log_err("euc-jp->u with substitute did not match.\n");
-
-
-
     }
     }
+#endif
+
     log_verbose("Testing toUnicode for UTF-8 with UCNV_TO_U_CALLBACK_SUBSTITUTE \n");
     {
         const uint8_t sampleText1[] = { 0x31, 0xe4, 0xba, 0x8c, 
     log_verbose("Testing toUnicode for UTF-8 with UCNV_TO_U_CALLBACK_SUBSTITUTE \n");
     {
         const uint8_t sampleText1[] = { 0x31, 0xe4, 0xba, 0x8c, 
@@ -1635,6 +1632,7 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
             log_err("scsu->u with stop did not match.\n");;
     }
 
             log_err("scsu->u with stop did not match.\n");;
     }
 
+#if !UCONFIG_NO_LEGACY_CONVERSION
     log_verbose("Testing ibm-930 subchar/subchar1\n");
     {
         static const UChar u1[]={         0x6d63,           0x6d64,     0x6d65,     0x6d66,     0xdf };
     log_verbose("Testing ibm-930 subchar/subchar1\n");
     {
         static const UChar u1[]={         0x6d63,           0x6d64,     0x6d65,     0x6d66,     0xdf };
@@ -1660,13 +1658,6 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
 
     log_verbose("Testing GB 18030 with substitute callbacks\n");
     {
 
     log_verbose("Testing GB 18030 with substitute callbacks\n");
     {
-        static const UChar u1[]={
-            0x24, 0x7f, 0x80,                   0x1f9,      0x20ac,     0x4e00,     0x9fa6,                 0xffff,                 0xd800, 0xdc00,         0xdbff, 0xdfff };
-        static const uint8_t gb1[]={
-            0x24, 0x7f, 0x81, 0x30, 0x81, 0x30, 0xa8, 0xbf, 0xa2, 0xe3, 0xd2, 0xbb, 0x82, 0x35, 0x8f, 0x33, 0x84, 0x31, 0xa4, 0x39, 0x90, 0x30, 0x81, 0x30, 0xe3, 0x32, 0x9a, 0x35 };
-        static const int32_t offsets1[]={
-            0, 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 10, 10, 10, 10 };
-
         static const UChar u2[]={
             0x24, 0x7f, 0x80,                   0x1f9,      0x20ac,     0x4e00,     0x9fa6,                 0xffff,                 0xd800, 0xdc00,         0xfffd,                 0xdbff, 0xdfff };
         static const uint8_t gb2[]={
         static const UChar u2[]={
             0x24, 0x7f, 0x80,                   0x1f9,      0x20ac,     0x4e00,     0x9fa6,                 0xffff,                 0xd800, 0xdc00,         0xfffd,                 0xdbff, 0xdfff };
         static const uint8_t gb2[]={
@@ -1674,30 +1665,25 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
         static const int32_t offsets2[]={
             0, 1, 2, 6, 8, 10, 12, 16, 20, 20, 24, 28, 28 };
 
         static const int32_t offsets2[]={
             0, 1, 2, 6, 8, 10, 12, 16, 20, 20, 24, 28, 28 };
 
-        if(!testConvertFromUnicode(u1, ARRAY_LENGTH(u1), gb1, ARRAY_LENGTH(gb1), "gb18030", 
-                                   UCNV_FROM_U_CALLBACK_SUBSTITUTE, offsets1, NULL, 0)
-        ) {
-            log_err("u->gb18030 with substitute did not match.\n");
-        }
-
         if(!testConvertToUnicode(gb2, ARRAY_LENGTH(gb2), u2, ARRAY_LENGTH(u2), "gb18030", 
                                  UCNV_TO_U_CALLBACK_SUBSTITUTE, offsets2, NULL, 0)
         ) {
             log_err("gb18030->u with substitute did not match.\n");
         }
     }
         if(!testConvertToUnicode(gb2, ARRAY_LENGTH(gb2), u2, ARRAY_LENGTH(u2), "gb18030", 
                                  UCNV_TO_U_CALLBACK_SUBSTITUTE, offsets2, NULL, 0)
         ) {
             log_err("gb18030->u with substitute did not match.\n");
         }
     }
+#endif
 
     log_verbose("Testing UTF-7 toUnicode with substitute callbacks\n");
     {
         static const uint8_t utf7[]={
 
     log_verbose("Testing UTF-7 toUnicode with substitute callbacks\n");
     {
         static const uint8_t utf7[]={
-         /* a~            a+AB~                         a+AB\x0c                      a+AB-                         a+AB.                         a+. */
-            0x61, 0x7e,   0x61, 0x2b, 0x41, 0x42, 0x7e, 0x61, 0x2b, 0x41, 0x42, 0x0c, 0x61, 0x2b, 0x41, 0x42, 0x2d, 0x61, 0x2b, 0x41, 0x42, 0x2e, 0x61, 0x2b, 0x2e
+         /* a~            a+AB~                           a+AB\x0c                        a+AB-                         a+AB.                         a+. */
+            0x61, 0x7e,   0x61, 0x2b, 0x41, 0x42, 0x7e,   0x61, 0x2b, 0x41, 0x42, 0x0c,   0x61, 0x2b, 0x41, 0x42, 0x2d, 0x61, 0x2b, 0x41, 0x42, 0x2e, 0x61, 0x2b,   0x2e
         };
         static const UChar unicode[]={
         };
         static const UChar unicode[]={
-            0x61, 0xfffd, 0x61,       0xfffd,           0x61,       0xfffd,           0x61,       0xfffd,           0x61,       0xfffd,           0x61, 0xfffd
+            0x61, 0xfffd, 0x61,       0xfffd,     0xfffd, 0x61,       0xfffd,     0xfffd, 0x61,       0xfffd,           0x61,       0xfffd,     0x2e, 0x61, 0xfffd, 0x2e
         };
         static const int32_t offsets[]={
         };
         static const int32_t offsets[]={
-            0,    1,      2,          4,                7,          9,                12,         14,               17,         19,               22,   23
+            0,    1,      2,          4,          6,      7,          9,          11,     12,         14,               17,         19,         21,   22,   23,     24
         };
 
         if(!testConvertToUnicode(utf7, ARRAY_LENGTH(utf7), unicode, ARRAY_LENGTH(unicode), "UTF-7", 
         };
 
         if(!testConvertToUnicode(utf7, ARRAY_LENGTH(utf7), unicode, ARRAY_LENGTH(unicode), "UTF-7", 
@@ -1707,26 +1693,6 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
         }
     }
 
         }
     }
 
-    log_verbose("Testing IMAP-mailbox-name toUnicode with substitute callbacks\n");
-    {
-        static const uint8_t bytes[]={
-         /* aDEL          a&AB~                         a&AB\x0c                      a&AB-                         a&AB.                         a&. */
-            0x61, 0x7f,   0x61, 0x26, 0x41, 0x42, 0x7e, 0x61, 0x26, 0x41, 0x42, 0x0c, 0x61, 0x26, 0x41, 0x42, 0x2d, 0x61, 0x26, 0x41, 0x42, 0x2e, 0x61, 0x26, 0x2e
-        };
-        static const UChar unicode[]={
-            0x61, 0xfffd, 0x61,       0xfffd,           0x61,       0xfffd,           0x61,       0xfffd,           0x61,       0xfffd,           0x61, 0xfffd
-        };
-        static const int32_t offsets[]={
-            0,    1,      2,          4,                7,          9,                12,         14,               17,         19,               22,   23
-        };
-
-        if(!testConvertToUnicode(bytes, ARRAY_LENGTH(bytes), unicode, ARRAY_LENGTH(unicode), "IMAP-mailbox-name", 
-                                 UCNV_TO_U_CALLBACK_SUBSTITUTE, offsets, NULL, 0)
-        ) {
-            log_err("IMAP-mailbox-name->u with substitute did not match.\n");
-        }
-    }
-
     log_verbose("Testing UTF-16 toUnicode with substitute callbacks\n");
     {
         static const uint8_t
     log_verbose("Testing UTF-16 toUnicode with substitute callbacks\n");
     {
         static const uint8_t
@@ -1772,10 +1738,10 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
             in4[]={ 0x00, 0x01, 0x02, 0x03,   0x00, 0x11, 0x12, 0x00,   0x00, 0x00, 0x4e, 0x00 };
 
         static const UChar
             in4[]={ 0x00, 0x01, 0x02, 0x03,   0x00, 0x11, 0x12, 0x00,   0x00, 0x00, 0x4e, 0x00 };
 
         static const UChar
-            out1[]={ UTF16_LEAD(0x100f00), UTF16_TRAIL(0x100f00), 0xfeff },
-            out2[]={ UTF16_LEAD(0x0f1000), UTF16_TRAIL(0x0f1000), 0xfffe },
-            out3[]={ 0xfefe, UTF16_LEAD(0x100f00), UTF16_TRAIL(0x100f00), 0xd840, 0xdc01 },
-            out4[]={ UTF16_LEAD(0x10203), UTF16_TRAIL(0x10203), 0xfffd, 0x4e00 };
+            out1[]={ U16_LEAD(0x100f00), U16_TRAIL(0x100f00), 0xfeff },
+            out2[]={ U16_LEAD(0x0f1000), U16_TRAIL(0x0f1000), 0xfffe },
+            out3[]={ 0xfefe, U16_LEAD(0x100f00), U16_TRAIL(0x100f00), 0xfffd, 0xfffd },
+            out4[]={ U16_LEAD(0x10203), U16_TRAIL(0x10203), 0xfffd, 0x4e00 };
 
         static const int32_t
             offsets1[]={ 4, 4, 8 },
 
         static const int32_t
             offsets1[]={ 4, 4, 8 },
@@ -1833,6 +1799,8 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
     gOutBufferSize = outputsize;
 
     /*from Unicode*/
     gOutBufferSize = outputsize;
 
     /*from Unicode*/
+
+#if !UCONFIG_NO_LEGACY_CONVERSION
     if(!testConvertFromUnicode(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
             expsubwvalIBM_949, sizeof(expsubwvalIBM_949), "ibm-949", 
             UCNV_FROM_U_CALLBACK_ESCAPE, toIBM949Offs, NULL, 0 ))
     if(!testConvertFromUnicode(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
             expsubwvalIBM_949, sizeof(expsubwvalIBM_949), "ibm-949", 
             UCNV_FROM_U_CALLBACK_ESCAPE, toIBM949Offs, NULL, 0 ))
@@ -1889,22 +1857,6 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
              6, 7, 7, 8,
         };
         /*ISO-2022-JP*/
              6, 7, 7, 8,
         };
         /*ISO-2022-JP*/
-        static const UChar iso_2022_jp_inputText[]={ 0x0041, 0x00E9, 0x0042,0x00E9,0x3000 };
-        static const uint8_t to_iso_2022_jp[]={  
-               0x41,   
-               0x25,  0x55,   0x30,   0x30,   0x45,   0x39,   
-               0x42,
-               0x25,  0x55,   0x30,   0x30,   0x45,   0x39,
-               0x1b,  0x24,   0x42,   0x21,   0x21, 
-        };
-
-        static const int32_t from_iso_2022_jpOffs [] ={ 
-            0,
-            1,1,1,1,1,1,
-            2,
-            3,3,3,3,3,3,
-            4,4,4,4,4
-        };
         static const UChar iso_2022_jp_inputText1[]={ 0x3000, 0x00E9, 0x3001,0x00E9, 0x0042} ;
         static const uint8_t to_iso_2022_jp1[]={  
             0x1b,   0x24,   0x42,   0x21, 0x21,   
         static const UChar iso_2022_jp_inputText1[]={ 0x3000, 0x00E9, 0x3001,0x00E9, 0x0042} ;
         static const uint8_t to_iso_2022_jp1[]={  
             0x1b,   0x24,   0x42,   0x21, 0x21,   
@@ -1945,48 +1897,15 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
         /*ISO-2022-cn*/
         static const UChar iso_2022_cn_inputText[]={ 0x0041, 0x3712, 0x0042, };
         static const uint8_t to_iso_2022_cn[]={  
         /*ISO-2022-cn*/
         static const UChar iso_2022_cn_inputText[]={ 0x0041, 0x3712, 0x0042, };
         static const uint8_t to_iso_2022_cn[]={  
-            0x0F,   0x41,   
-            0x0f,   0x25, 0x55,   0x33,   0x37,   0x31,   0x32,   
+            0x41,   
+            0x25, 0x55,   0x33,   0x37,   0x31,   0x32,   
             0x42, 
         };
         static const int32_t from_iso_2022_cnOffs [] ={ 
             0x42, 
         };
         static const int32_t from_iso_2022_cnOffs [] ={ 
-            0,0,
-            1,1,1,1,1,1,1,
+            0,
+            1,1,1,1,1,1,
             2,
         };
             2,
         };
-        static const UChar iso_2022_cn_inputText1[]={ 0x4e00, 0x3712, 0x4e01, };
-        static const uint8_t to_iso_2022_cn1[]={  
-                        0x1b,   0x24,   0x29,   0x41,   0x0e,   0x52,   0x3b,   
-                        0x0f,   0x25,   0x55,   0x33,   0x37,   0x31,   0x32, 
-                        0x1b,   0x24,   0x29,   0x41,   0x0e,   0x36,   0x21,
-        };
-        static const int32_t from_iso_2022_cnOffs1 [] ={ 
-                0, 0, 0, 0, 0, 0, 0, 
-                1, 1, 1, 1, 1, 1, 1, 
-                2, 2, 2, 2, 2, 2, 2,
-        };
-        static const UChar iso_2022_cn_inputText3[]={ 0x3000, 0x3712, 0x3001, };
-        static const uint8_t to_iso_2022_cn3[]={  
-               0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x21,   
-              0x0f,   0x25,   0x55,   0x33,   0x37,   0x31,   0x32,   
-             0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x22, 
-        };
-        static const int32_t from_iso_2022_cnOffs3 [] ={ 
-            0,0,0,0,0,0,0,
-            1,1,1,1,1,1,1,
-            2,2,2,2,2,2,2
-        };
-        static const UChar iso_2022_cn_inputText2[]={ 0x0041, 0x3712, 0x4e00, };
-        static const uint8_t to_iso_2022_cn2[]={  
-            0x0F,   0x41,   
-            0x0f,   0x25,   0x55,   0x33,   0x37,   0x31,   0x32,   
-            0x1b,   0x24,   0x29,   0x41,   0x0e,   0x52,   0x3b,
-        };
-        static const int32_t from_iso_2022_cnOffs2 [] ={ 
-            0,0,
-            1,1,1,1,1,1,1,
-            2,2,2,2,2,2,2
-        };
         
         static const UChar iso_2022_cn_inputText4[]={ 0x3000, 0xD84D, 0xDC56, 0x3001,0xD84D,0xDC56, 0x0042};
 
         
         static const UChar iso_2022_cn_inputText4[]={ 0x3000, 0xD84D, 0xDC56, 0x3001,0xD84D,0xDC56, 0x0042};
 
@@ -1994,7 +1913,7 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
                              0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x21,   
                              0x0f,   0x25,   0x55,   0x44,   0x38,   0x34,   0x44,   
                              0x25,   0x55,   0x44,   0x43,   0x35,   0x36,   
                              0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x21,   
                              0x0f,   0x25,   0x55,   0x44,   0x38,   0x34,   0x44,   
                              0x25,   0x55,   0x44,   0x43,   0x35,   0x36,   
-                             0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x22,   
+                             0x0e,   0x21,   0x22,   
                              0x0f,   0x25,   0x55,   0x44,   0x38,   0x34,   0x44,   
                              0x25,   0x55,   0x44,   0x43,   0x35,   0x36,   
                              0x42, 
                              0x0f,   0x25,   0x55,   0x44,   0x38,   0x34,   0x44,   
                              0x25,   0x55,   0x44,   0x43,   0x35,   0x36,   
                              0x42, 
@@ -2003,7 +1922,7 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
             0,0,0,0,0,0,0,
             1,1,1,1,1,1,1,
             1,1,1,1,1,1,
             0,0,0,0,0,0,0,
             1,1,1,1,1,1,1,
             1,1,1,1,1,1,
-            3,3,3,3,3,3,3,
+            3,3,3,
             4,4,4,4,4,4,4,
             4,4,4,4,4,4,
             6
             4,4,4,4,4,4,4,
             4,4,4,4,4,4,
             6
@@ -2104,30 +2023,6 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
         };
 
                 /*ISCII*/
         };
 
                 /*ISCII*/
-        static const UChar iscii_inputText2[]={ 0x0041, 0x0901,0xD84D, 0xDC56/*unassigned*/,0x0902, 0x0042,0xD84D, 0xDC56/*unassigned*/,0x43 };
-        static const uint8_t to_iscii2[]={  
-            0x41,   
-            0xef,   0x42,   0xa1,    
-            0x25,   0x55,   0x44,   0x38,   0x34,   0x44,   
-            0x25,   0x55,   0x44,   0x43,   0x35,   0x36,  
-            0xa2, 
-            0x42, 
-            0x25,   0x55,   0x44,   0x38,   0x34,   0x44,   
-            0x25,   0x55,   0x44,   0x43,   0x35,   0x36,  
-            0x43
-        };
-        static const int32_t from_isciiOffs2 [] ={ 
-            0,
-            1,1,1,
-            2,2,2,2,2,2,
-            2,2,2,2,2,2,
-            4,
-            5,
-            6,6,6,6,6,6,
-            6,6,6,6,6,6,
-            8,
-        };
-
         static const UChar iscii_inputText[]={ 0x0041, 0x0901,0x3712/*unassigned*/,0x0902, 0x0042,0x3712/*unassigned*/,0x43 };
         static const uint8_t to_iscii[]={   
             0x41,   
         static const UChar iscii_inputText[]={ 0x0041, 0x0901,0x3712/*unassigned*/,0x0902, 0x0042,0x3712/*unassigned*/,0x43 };
         static const uint8_t to_iscii[]={   
             0x41,   
@@ -2156,7 +2051,7 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
             log_err("u-> ibm-943 with subst with value did not match.\n");
 
         if(!testConvertFromUnicode(euc_jp_inputText, sizeof(euc_jp_inputText)/sizeof(euc_jp_inputText[0]),
             log_err("u-> ibm-943 with subst with value did not match.\n");
 
         if(!testConvertFromUnicode(euc_jp_inputText, sizeof(euc_jp_inputText)/sizeof(euc_jp_inputText[0]),
-                to_euc_jp, sizeof(to_euc_jp), "euc-jp",
+                to_euc_jp, sizeof(to_euc_jp), "IBM-eucJP",
                 UCNV_FROM_U_CALLBACK_ESCAPE, fromEUC_JPOffs, NULL, 0 ))
             log_err("u-> euc-jp with subst with value did not match.\n");
 
                 UCNV_FROM_U_CALLBACK_ESCAPE, fromEUC_JPOffs, NULL, 0 ))
             log_err("u-> euc-jp with subst with value did not match.\n");
 
@@ -2165,11 +2060,6 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
                 UCNV_FROM_U_CALLBACK_ESCAPE, from_euc_twOffs, NULL, 0 ))
             log_err("u-> euc-tw with subst with value did not match.\n");  
         
                 UCNV_FROM_U_CALLBACK_ESCAPE, from_euc_twOffs, NULL, 0 ))
             log_err("u-> euc-tw with subst with value did not match.\n");  
         
-        if(!testConvertFromUnicode(iso_2022_jp_inputText, sizeof(iso_2022_jp_inputText)/sizeof(iso_2022_jp_inputText[0]),
-                to_iso_2022_jp, sizeof(to_iso_2022_jp), "iso-2022-jp",
-                UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs, NULL, 0 ))
-            log_err("u-> iso_2022_jp with subst with value did not match.\n"); 
-     
         if(!testConvertFromUnicode(iso_2022_jp_inputText1, sizeof(iso_2022_jp_inputText1)/sizeof(iso_2022_jp_inputText1[0]),
                 to_iso_2022_jp1, sizeof(to_iso_2022_jp1), "iso-2022-jp",
                 UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs1, NULL, 0 ))
         if(!testConvertFromUnicode(iso_2022_jp_inputText1, sizeof(iso_2022_jp_inputText1)/sizeof(iso_2022_jp_inputText1[0]),
                 to_iso_2022_jp1, sizeof(to_iso_2022_jp1), "iso-2022-jp",
                 UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs1, NULL, 0 ))
@@ -2215,57 +2105,27 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
                     UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs3_v2, NULL, 0,UCNV_ESCAPE_XML_DEC,U_ZERO_ERROR ))
                 log_err("u-> iso-2022-jp with sub & UCNV_ESCAPE_XML_DEC did not match.\n"); 
         }
                     UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs3_v2, NULL, 0,UCNV_ESCAPE_XML_DEC,U_ZERO_ERROR ))
                 log_err("u-> iso-2022-jp with sub & UCNV_ESCAPE_XML_DEC did not match.\n"); 
         }
-        {
-            /* surrogate pair*/
-            static const UChar iso_2022_jp_inputText4[]={ 0x3000, 0xD84D, 0xDC56, 0x3001,0xD84D,0xDC56, 0x0042,0x0901c } ;
-            static const uint8_t to_iso_2022_jp4_v3[]={  
-                    0x1b,   0x24,   0x42,   0x21,   0x21,   
-                    0x1b,   0x28,   0x42,   0x26,   0x23,   0x78,  0x32,   0x33,   0x34,   0x35, 0x36, 0x3b ,  
-                      
-                    0x1b,   0x24,   0x42,   0x21,   0x22,
-                    0x1b,   0x28,   0x42,   0x26,   0x23,   0x78,  0x32,   0x33,   0x34,   0x35, 0x36, 0x3b ,
-                    
-                    0x42,
-                    0x26,   0x23,   0x78,   0x39,   0x30,   0x31,   0x43,   0x3b,
-                    };
-
-            static const int32_t from_iso_2022_jpOffs4_v3 [] ={ 
-                0,0,0,0,0,
-                1,1,1,1,1,1,1,1,1,1,1,1,
-
-                3,3,3,3,3,
-                4,4,4,4,4,4,4,4,4,4,4,4,
-
-                6,
-                7,7,7,7,7,7,7,7
-            };
-            if(!testConvertFromUnicodeWithContext(iso_2022_jp_inputText4, sizeof(iso_2022_jp_inputText4)/sizeof(iso_2022_jp_inputText4[0]),
-                to_iso_2022_jp4_v3, sizeof(to_iso_2022_jp4_v3), "iso-2022-jp",
-                UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs4_v3, NULL, 0,UCNV_ESCAPE_XML_HEX,U_ZERO_ERROR ))
-                log_err("u-> iso-2022-jp with sub & UCNV_ESCAPE_XML_HEX did not match.\n"); 
-
-        }
         {
             static const UChar iso_2022_cn_inputText5[]={ 0x3000, 0xD84D, 0xDC56, 0x3001,0xD84D,0xDC56, 0x0042,0x0902};
             static const uint8_t to_iso_2022_cn5_v2[]={  
                              0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x21,   
                              0x0f,   0x5c,   0x75,   0x44,   0x38,   0x34,   0x44,   
                              0x5c,   0x75,   0x44,   0x43,   0x35,   0x36,   
         {
             static const UChar iso_2022_cn_inputText5[]={ 0x3000, 0xD84D, 0xDC56, 0x3001,0xD84D,0xDC56, 0x0042,0x0902};
             static const uint8_t to_iso_2022_cn5_v2[]={  
                              0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x21,   
                              0x0f,   0x5c,   0x75,   0x44,   0x38,   0x34,   0x44,   
                              0x5c,   0x75,   0x44,   0x43,   0x35,   0x36,   
-                             0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x22,   
+                             0x0e,   0x21,   0x22,   
                              0x0f,   0x5c,   0x75,   0x44,   0x38,   0x34,   0x44,   
                              0x5c,   0x75,   0x44,   0x43,   0x35,   0x36,   
                              0x42,
                              0x0f,   0x5c,   0x75,   0x44,   0x38,   0x34,   0x44,   
                              0x5c,   0x75,   0x44,   0x43,   0x35,   0x36,   
                              0x42,
-                             0x0f,   0x5c,   0x75,   0x30,   0x39,   0x30,   0x32,
+                             0x5c,   0x75,   0x30,   0x39,   0x30,   0x32,
                              };
             static const int32_t from_iso_2022_cnOffs5_v2 [] ={ 
                 0,0,0,0,0,0,0,
                 1,1,1,1,1,1,1,
                 1,1,1,1,1,1,
                              };
             static const int32_t from_iso_2022_cnOffs5_v2 [] ={ 
                 0,0,0,0,0,0,0,
                 1,1,1,1,1,1,1,
                 1,1,1,1,1,1,
-                3,3,3,3,3,3,3,
+                3,3,3,
                 4,4,4,4,4,4,4,
                 4,4,4,4,4,4,
                 6, 
                 4,4,4,4,4,4,4,
                 4,4,4,4,4,4,
                 6, 
-                7,7,7,7,7,7,7
+                7,7,7,7,7,7
             };
             if(!testConvertFromUnicodeWithContext(iso_2022_cn_inputText5, sizeof(iso_2022_cn_inputText5)/sizeof(iso_2022_cn_inputText5[0]),
                 to_iso_2022_cn5_v2, sizeof(to_iso_2022_cn5_v2), "iso-2022-cn",
             };
             if(!testConvertFromUnicodeWithContext(iso_2022_cn_inputText5, sizeof(iso_2022_cn_inputText5)/sizeof(iso_2022_cn_inputText5[0]),
                 to_iso_2022_cn5_v2, sizeof(to_iso_2022_cn5_v2), "iso-2022-cn",
@@ -2278,18 +2138,18 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
             static const uint8_t to_iso_2022_cn6_v2[]={  
                                 0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x21,   
                                 0x0f,   0x7b,   0x55,   0x2b,   0x32,   0x33,   0x34,   0x35,   0x36,   0x7d,   
             static const uint8_t to_iso_2022_cn6_v2[]={  
                                 0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x21,   
                                 0x0f,   0x7b,   0x55,   0x2b,   0x32,   0x33,   0x34,   0x35,   0x36,   0x7d,   
-                                0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x22,   
+                                0x0e,   0x21,   0x22,   
                                 0x0f,   0x7b,   0x55,   0x2b,   0x32,   0x33,   0x34,   0x35,   0x36,   0x7d,   
                                 0x42,   
                                 0x0f,   0x7b,   0x55,   0x2b,   0x32,   0x33,   0x34,   0x35,   0x36,   0x7d,   
                                 0x42,   
-                                0x0f,   0x7b,   0x55,   0x2b,   0x30,   0x39,   0x30,   0x32,   0x7d
+                                0x7b,   0x55,   0x2b,   0x30,   0x39,   0x30,   0x32,   0x7d
                              };
             static const int32_t from_iso_2022_cnOffs6_v2 [] ={ 
                     0,  0,  0,  0,  0,  0,  0,  
                     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  
                              };
             static const int32_t from_iso_2022_cnOffs6_v2 [] ={ 
                     0,  0,  0,  0,  0,  0,  0,  
                     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  
-                    3,  3,  3,  3,  3,  3,  3,  
+                    3,  3,  3,  
                     4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  
                     6, 
                     4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  
                     6, 
-                    7,  7,  7,  7,  7,  7,  7,  7,  7,
+                    7,  7,  7,  7,  7,  7,  7,  7,
             };
             if(!testConvertFromUnicodeWithContext(iso_2022_cn_inputText6, sizeof(iso_2022_cn_inputText6)/sizeof(iso_2022_cn_inputText6[0]),
                 to_iso_2022_cn6_v2, sizeof(to_iso_2022_cn6_v2), "iso-2022-cn",
             };
             if(!testConvertFromUnicodeWithContext(iso_2022_cn_inputText6, sizeof(iso_2022_cn_inputText6)/sizeof(iso_2022_cn_inputText6[0]),
                 to_iso_2022_cn6_v2, sizeof(to_iso_2022_cn6_v2), "iso-2022-cn",
@@ -2302,29 +2162,62 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
             static const uint8_t to_iso_2022_cn7_v2[]={  
                                 0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x21,   
                                 0x0f,   0x25,   0x55,   0x44,   0x38,   0x34,   0x44,   0x25,   0x55,   0x44,   0x43,   0x35,   0x36,   
             static const uint8_t to_iso_2022_cn7_v2[]={  
                                 0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x21,   
                                 0x0f,   0x25,   0x55,   0x44,   0x38,   0x34,   0x44,   0x25,   0x55,   0x44,   0x43,   0x35,   0x36,   
-                                0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x22,   
+                                0x0e,   0x21,   0x22,   
                                 0x0f,   0x25,   0x55,   0x44,   0x38,   0x34,   0x44,   0x25,   0x55,   0x44,   0x43,   0x35,   0x36,   
                                 0x0f,   0x25,   0x55,   0x44,   0x38,   0x34,   0x44,   0x25,   0x55,   0x44,   0x43,   0x35,   0x36,   
-                                0x42,   0x0f,   0x25,   0x55,   0x30,   0x39,   0x30,   0x32, 
+                                0x42,   0x25,   0x55,   0x30,   0x39,   0x30,   0x32, 
                             };
             static const int32_t from_iso_2022_cnOffs7_v2 [] ={ 
                                 0,  0,  0,  0,  0,  0,  0,  
                                 1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  
                             };
             static const int32_t from_iso_2022_cnOffs7_v2 [] ={ 
                                 0,  0,  0,  0,  0,  0,  0,  
                                 1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  
-                                3,  3,  3,  3,  3,  3,  3,  
+                                3,  3,  3,  
                                 4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  
                                 6,  
                                 4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  
                                 6,  
-                                7,  7,  7,  7,  7,  7,  7,
+                                7,  7,  7,  7,  7,  7,
             };
             if(!testConvertFromUnicodeWithContext(iso_2022_cn_inputText7, sizeof(iso_2022_cn_inputText7)/sizeof(iso_2022_cn_inputText7[0]),
                 to_iso_2022_cn7_v2, sizeof(to_iso_2022_cn7_v2), "iso-2022-cn",
                 UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs7_v2, NULL, 0,"K" ,U_ZERO_ERROR ))
                 log_err("u-> iso-2022-cn with sub & K did not match.\n"); 
 
             };
             if(!testConvertFromUnicodeWithContext(iso_2022_cn_inputText7, sizeof(iso_2022_cn_inputText7)/sizeof(iso_2022_cn_inputText7[0]),
                 to_iso_2022_cn7_v2, sizeof(to_iso_2022_cn7_v2), "iso-2022-cn",
                 UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs7_v2, NULL, 0,"K" ,U_ZERO_ERROR ))
                 log_err("u-> iso-2022-cn with sub & K did not match.\n"); 
 
+        }
+        {
+            static const UChar iso_2022_cn_inputText8[]={
+                                0x3000,
+                                0xD84D, 0xDC56,
+                                0x3001,
+                                0xD84D, 0xDC56,
+                                0xDBFF, 0xDFFF,
+                                0x0042,
+                                0x0902};
+            static const uint8_t to_iso_2022_cn8_v2[]={  
+                                0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x21,   
+                                0x0f,   0x5c,   0x32,   0x33,   0x34,   0x35,   0x36,   0x20,   
+                                0x0e,   0x21,   0x22,   
+                                0x0f,   0x5c,   0x32,   0x33,   0x34,   0x35,   0x36,   0x20,   
+                                0x5c,   0x31,   0x30,   0x46,   0x46,   0x46,   0x46,   0x20,   
+                                0x42,   
+                                0x5c,   0x39,   0x30,   0x32,   0x20
+                             };
+            static const int32_t from_iso_2022_cnOffs8_v2 [] ={
+                    0,  0,  0,  0,  0,  0,  0,
+                    1,  1,  1,  1,  1,  1,  1,  1,
+                    3,  3,  3,
+                    4,  4,  4,  4,  4,  4,  4,  4,
+                    6,  6,  6,  6,  6,  6,  6,  6,
+                    8,
+                    9,  9,  9,  9,  9
+            };
+            if(!testConvertFromUnicodeWithContext(iso_2022_cn_inputText8, sizeof(iso_2022_cn_inputText8)/sizeof(iso_2022_cn_inputText8[0]),
+                to_iso_2022_cn8_v2, sizeof(to_iso_2022_cn8_v2), "iso-2022-cn",
+                UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs8_v2, NULL, 0,UCNV_ESCAPE_CSS2,U_ZERO_ERROR ))
+                log_err("u-> iso-2022-cn with sub & UCNV_ESCAPE_CSS2 did not match.\n"); 
+
         }
         {
             static const uint8_t to_iso_2022_cn4_v3[]={  
                             0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x21,   
                             0x0f,   0x5c,   0x55,   0x30,   0x30,   0x30,   0x32,   0x33,   0x34,   0x35,   0x36,   
         }
         {
             static const uint8_t to_iso_2022_cn4_v3[]={  
                             0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x21,   
                             0x0f,   0x5c,   0x55,   0x30,   0x30,   0x30,   0x32,   0x33,   0x34,   0x35,   0x36,   
-                            0x1b,   0x24,   0x29,   0x41,   0x0e,   0x21,   0x22,
+                            0x0e,   0x21,   0x22,
                             0x0f,   0x5c,   0x55,   0x30,   0x30,   0x30,   0x32,   0x33,   0x34,   0x35,   0x36, 
                             0x42 
                              };
                             0x0f,   0x5c,   0x55,   0x30,   0x30,   0x30,   0x32,   0x33,   0x34,   0x35,   0x36, 
                             0x42 
                              };
@@ -2334,7 +2227,7 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
                 0,0,0,0,0,0,0,
                 1,1,1,1,1,1,1,1,1,1,1,
 
                 0,0,0,0,0,0,0,
                 1,1,1,1,1,1,1,1,1,1,1,
 
-                3,3,3,3,3,3,3,
+                3,3,3,
                 4,4,4,4,4,4,4,4,4,4,4,
 
                 6
                 4,4,4,4,4,4,4,4,4,4,4,
 
                 6
@@ -2352,18 +2245,6 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
                 UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs, NULL, 0 ))
             log_err("u-> iso_2022_cn with subst with value did not match.\n");
 
                 UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs, NULL, 0 ))
             log_err("u-> iso_2022_cn with subst with value did not match.\n");
 
-        if(!testConvertFromUnicode(iso_2022_cn_inputText1, sizeof(iso_2022_cn_inputText1)/sizeof(iso_2022_cn_inputText1[0]),
-                to_iso_2022_cn1, sizeof(to_iso_2022_cn1), "iso-2022-cn",
-                UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs1, NULL, 0 ))
-            log_err("u-> iso_2022_cn with subst with value did not match.\n"); 
-        if(!testConvertFromUnicode(iso_2022_cn_inputText2, sizeof(iso_2022_cn_inputText2)/sizeof(iso_2022_cn_inputText2[0]),
-                to_iso_2022_cn2, sizeof(to_iso_2022_cn2), "iso-2022-cn",
-                UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs2, NULL, 0 ))
-            log_err("u-> iso_2022_cn with subst with value did not match.\n");
-        if(!testConvertFromUnicode(iso_2022_cn_inputText3, sizeof(iso_2022_cn_inputText3)/sizeof(iso_2022_cn_inputText3[0]),
-                to_iso_2022_cn3, sizeof(to_iso_2022_cn3), "iso-2022-cn",
-                UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs3, NULL, 0 ))
-            log_err("u-> iso_2022_cn with subst with value did not match.\n");
         if(!testConvertFromUnicode(iso_2022_cn_inputText4, sizeof(iso_2022_cn_inputText4)/sizeof(iso_2022_cn_inputText4[0]),
                 to_iso_2022_cn4, sizeof(to_iso_2022_cn4), "iso-2022-cn",
                 UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs4, NULL, 0 ))
         if(!testConvertFromUnicode(iso_2022_cn_inputText4, sizeof(iso_2022_cn_inputText4)/sizeof(iso_2022_cn_inputText4[0]),
                 to_iso_2022_cn4, sizeof(to_iso_2022_cn4), "iso-2022-cn",
                 UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs4, NULL, 0 ))
@@ -2389,17 +2270,13 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
                 to_iscii, sizeof(to_iscii), "ISCII,version=0",
                 UCNV_FROM_U_CALLBACK_ESCAPE, from_isciiOffs, NULL, 0 ))
             log_err("u-> iscii with subst with value did not match.\n");
                 to_iscii, sizeof(to_iscii), "ISCII,version=0",
                 UCNV_FROM_U_CALLBACK_ESCAPE, from_isciiOffs, NULL, 0 ))
             log_err("u-> iscii with subst with value did not match.\n");
-        
-        if(!testConvertFromUnicode(iscii_inputText2, sizeof(iscii_inputText2)/sizeof(iscii_inputText2[0]),
-                to_iscii2, sizeof(to_iscii2), "ISCII,version=0",
-                UCNV_FROM_U_CALLBACK_ESCAPE, from_isciiOffs2, NULL, 0 ))
-            log_err("u-> iscii2 with subst with value did not match.\n");
     }
     }
-
+#endif
 
     log_verbose("Testing toUnicode with UCNV_TO_U_CALLBACK_ESCAPE \n");
     /*to Unicode*/
     {
 
     log_verbose("Testing toUnicode with UCNV_TO_U_CALLBACK_ESCAPE \n");
     /*to Unicode*/
     {
+#if !UCONFIG_NO_LEGACY_CONVERSION
         static const uint8_t sampleTxtToU[]= { 0x00, 0x9f, 0xaf, 
             0x81, 0xad, /*unassigned*/
             0x89, 0xd3 };
         static const uint8_t sampleTxtToU[]= { 0x00, 0x9f, 0xaf, 
             0x81, 0xad, /*unassigned*/
             0x89, 0xd3 };
@@ -2437,13 +2314,14 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
         /*iso-2022-jp*/
         static const uint8_t sampleTxt_iso_2022_jp[]={ 
             0x1b,   0x28,   0x42,   0x41,
         /*iso-2022-jp*/
         static const uint8_t sampleTxt_iso_2022_jp[]={ 
             0x1b,   0x28,   0x42,   0x41,
-            0x1b,   0x24,   0x42,   0x2A, 0x44, /*unassigned*/
+            0x1b,   0x24,   0x42,   0x3a, 0x1a, /*unassigned*/
             0x1b,   0x28,   0x42,   0x42,
             
         };
             0x1b,   0x28,   0x42,   0x42,
             
         };
-        static const UChar iso_2022_jptoUnicode[]={    0x41,0x25,0x58,0x32,0x41,0x25,0x58,0x34,0x34, 0x42 };
+                                                   /*     A    %    X    3    A    %    X    1    A     B    */
+        static const UChar iso_2022_jptoUnicode[]={    0x41,0x25,0x58,0x33,0x41,0x25,0x58,0x31,0x41, 0x42 };
         static const int32_t from_iso_2022_jpOffs [] ={  3,   7,   7,   7,   7,   7,   7,   7,   7,    12   };
         static const int32_t from_iso_2022_jpOffs [] ={  3,   7,   7,   7,   7,   7,   7,   7,   7,    12   };
-        
+
         /*iso-2022-cn*/
         static const uint8_t sampleTxt_iso_2022_cn[]={ 
             0x0f,   0x41,   0x44,
         /*iso-2022-cn*/
         static const uint8_t sampleTxt_iso_2022_cn[]={ 
             0x0f,   0x41,   0x44,
@@ -2510,19 +2388,7 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
             0x42,};
 
         static const int32_t from_isciiOffs [] ={0,1,2,2,2,2,3,4,5,5,5,5,6  };
             0x42,};
 
         static const int32_t from_isciiOffs [] ={0,1,2,2,2,2,3,4,5,5,5,5,6  };
-
-
-        /*LMBCS*/
-        static const uint8_t sampleTxtLMBCS[]={ 0x12, 0xc9, 0x50, 
-            0x12, 0x92, 0xa0, /*unassigned*/
-            0x12, 0x92, 0xa1,
-        };
-        static const UChar LMBCSToUnicode[]={ 0x4e2e, 
-            0x25, 0x58, 0x31, 0x32, 0x25, 0x58, 0x39, 0x32, 0x25, 0x58, 0x41, 0x30, 
-            0xe5c4, };
-        static const int32_t fromLMBCS[] = {0, 
-            3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
-            6, };
+#endif
 
         /*UTF8*/
         static const uint8_t sampleTxtUTF8[]={
 
         /*UTF8*/
         static const uint8_t sampleTxtUTF8[]={
@@ -2561,14 +2427,15 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
             9
         };
 
             9
         };
 
-        
+
+#if !UCONFIG_NO_LEGACY_CONVERSION        
         if(!testConvertToUnicode(sampleTxtToU, sizeof(sampleTxtToU),
                  IBM_943toUnicode, sizeof(IBM_943toUnicode)/sizeof(IBM_943toUnicode[0]),"ibm-943",
                 UCNV_TO_U_CALLBACK_ESCAPE, fromIBM943Offs, NULL, 0 ))
             log_err("ibm-943->u with substitute with value did not match.\n");
 
         if(!testConvertToUnicode(sampleTxt_EUC_JP, sizeof(sampleTxt_EUC_JP),
         if(!testConvertToUnicode(sampleTxtToU, sizeof(sampleTxtToU),
                  IBM_943toUnicode, sizeof(IBM_943toUnicode)/sizeof(IBM_943toUnicode[0]),"ibm-943",
                 UCNV_TO_U_CALLBACK_ESCAPE, fromIBM943Offs, NULL, 0 ))
             log_err("ibm-943->u with substitute with value did not match.\n");
 
         if(!testConvertToUnicode(sampleTxt_EUC_JP, sizeof(sampleTxt_EUC_JP),
-                 EUC_JPtoUnicode, sizeof(EUC_JPtoUnicode)/sizeof(EUC_JPtoUnicode[0]),"euc-jp",
+                 EUC_JPtoUnicode, sizeof(EUC_JPtoUnicode)/sizeof(EUC_JPtoUnicode[0]),"IBM-eucJP",
                 UCNV_TO_U_CALLBACK_ESCAPE, fromEUC_JPOffs, NULL, 0))
             log_err("euc-jp->u with substitute with value did not match.\n");
 
                 UCNV_TO_U_CALLBACK_ESCAPE, fromEUC_JPOffs, NULL, 0))
             log_err("euc-jp->u with substitute with value did not match.\n");
 
@@ -2591,8 +2458,9 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
             {
                 static const UChar iso_2022_jptoUnicodeDec[]={
                                                   0x0041,   
             {
                 static const UChar iso_2022_jptoUnicodeDec[]={
                                                   0x0041,   
-                                                  0x0026,   0x0023,   0x0034,   0x0032,   0x003b,   
-                                                  0x0026,   0x0023,   0x0036,   0x0038,   0x003b,   
+                                                  /*   &         #         5         8         ;   */
+                                                  0x0026,   0x0023,   0x0035,   0x0038,   0x003b,   
+                                                  0x0026,   0x0023,   0x0032,   0x0036,   0x003b,   
                                                   0x0042 };
                 static const int32_t from_iso_2022_jpOffsDec [] ={ 3,7,7,7,7,7,7,7,7,7,7,12,  };
                 if(!testConvertToUnicodeWithContext(sampleTxt_iso_2022_jp, sizeof(sampleTxt_iso_2022_jp),
                                                   0x0042 };
                 static const int32_t from_iso_2022_jpOffsDec [] ={ 3,7,7,7,7,7,7,7,7,7,7,12,  };
                 if(!testConvertToUnicodeWithContext(sampleTxt_iso_2022_jp, sizeof(sampleTxt_iso_2022_jp),
@@ -2603,8 +2471,9 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
             {
                 static const UChar iso_2022_jptoUnicodeHex[]={
                                                   0x0041, 
             {
                 static const UChar iso_2022_jptoUnicodeHex[]={
                                                   0x0041, 
-                                                  0x0026, 0x0023, 0x0078, 0x0032, 0x0041, 0x003b, 
-                                                  0x0026, 0x0023, 0x0078, 0x0034, 0x0034, 0x003b, 
+                                                  /*   &       #       x       3       A       ;  */
+                                                  0x0026, 0x0023, 0x0078, 0x0033, 0x0041, 0x003b, 
+                                                  0x0026, 0x0023, 0x0078, 0x0031, 0x0041, 0x003b, 
                                                   0x0042 };
                 static const int32_t from_iso_2022_jpOffsHex [] ={  3,7,7,7,7,7,7,7,7,7,7,7,7,12   };
                 if(!testConvertToUnicodeWithContext(sampleTxt_iso_2022_jp, sizeof(sampleTxt_iso_2022_jp),
                                                   0x0042 };
                 static const int32_t from_iso_2022_jpOffsHex [] ={  3,7,7,7,7,7,7,7,7,7,7,7,7,12   };
                 if(!testConvertToUnicodeWithContext(sampleTxt_iso_2022_jp, sizeof(sampleTxt_iso_2022_jp),
@@ -2615,8 +2484,8 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
             {
                 static const UChar iso_2022_jptoUnicodeC[]={
                                                 0x0041, 
             {
                 static const UChar iso_2022_jptoUnicodeC[]={
                                                 0x0041, 
-                                                0x005C, 0x0078, 0x0032, 0x0041,
-                                                0x005C, 0x0078, 0x0034, 0x0034, 
+                                                0x005C, 0x0078, 0x0033, 0x0041,   /*  \x3A */
+                                                0x005C, 0x0078, 0x0031, 0x0041,   /*  \x1A */
                                                 0x0042 };
                 int32_t from_iso_2022_jpOffsC [] ={  3,7,7,7,7,7,7,7,7,12   };
                 if(!testConvertToUnicodeWithContext(sampleTxt_iso_2022_jp, sizeof(sampleTxt_iso_2022_jp),
                                                 0x0042 };
                 int32_t from_iso_2022_jpOffsC [] ={  3,7,7,7,7,7,7,7,7,12   };
                 if(!testConvertToUnicodeWithContext(sampleTxt_iso_2022_jp, sizeof(sampleTxt_iso_2022_jp),
@@ -2644,10 +2513,8 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
                  isciitoUnicode, sizeof(isciitoUnicode)/sizeof(isciitoUnicode[0]),"ISCII,version=0",
                 UCNV_TO_U_CALLBACK_ESCAPE, from_isciiOffs, NULL, 0))
             log_err("ISCII ->u with substitute with value did not match.\n");
                  isciitoUnicode, sizeof(isciitoUnicode)/sizeof(isciitoUnicode[0]),"ISCII,version=0",
                 UCNV_TO_U_CALLBACK_ESCAPE, from_isciiOffs, NULL, 0))
             log_err("ISCII ->u with substitute with value did not match.\n");
-        if(!testConvertToUnicode(sampleTxtLMBCS, sizeof(sampleTxtLMBCS),
-                LMBCSToUnicode, sizeof(LMBCSToUnicode)/sizeof(LMBCSToUnicode[0]),"LMBCS",
-                UCNV_TO_U_CALLBACK_ESCAPE, fromLMBCS, NULL, 0))
-            log_err("LMBCS->u with substitute with value did not match.\n"); 
+#endif
+
         if(!testConvertToUnicode(sampleTxtUTF8, sizeof(sampleTxtUTF8),
                 UTF8ToUnicode, sizeof(UTF8ToUnicode)/sizeof(UTF8ToUnicode[0]),"UTF-8",
                 UCNV_TO_U_CALLBACK_ESCAPE, fromUTF8, NULL, 0))
         if(!testConvertToUnicode(sampleTxtUTF8, sizeof(sampleTxtUTF8),
                 UTF8ToUnicode, sizeof(UTF8ToUnicode)/sizeof(UTF8ToUnicode[0]),"UTF-8",
                 UCNV_TO_U_CALLBACK_ESCAPE, fromUTF8, NULL, 0))
@@ -2659,6 +2526,7 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
     }
 }
 
     }
 }
 
+#if !UCONFIG_NO_LEGACY_CONVERSION
 static void TestLegalAndOthers(int32_t inputsize, int32_t outputsize)
 {
     static const UChar    legalText[] =  { 0x0000, 0xAC00, 0xAC01, 0xD700 };
 static void TestLegalAndOthers(int32_t inputsize, int32_t outputsize)
 {
     static const UChar    legalText[] =  { 0x0000, 0xAC00, 0xAC01, 0xD700 };
@@ -2667,13 +2535,13 @@ static void TestLegalAndOthers(int32_t inputsize, int32_t outputsize)
 
 
     static const uint8_t text943[] = {
 
 
     static const uint8_t text943[] = {
-        0x82, 0xa9, 0x82, 0x20, /*0xc8,*/  0x61, 0x8a, 0xbf, 0x8e, 0x9a };
-    static const UChar toUnicode943sub[] = { 0x304b, 0xfffd, /*0xff88,*/ 0x0061, 0x6f22,  0x5b57};
-    static const UChar toUnicode943skip[]= { 0x304b, /*0xff88,*/ 0x0061, 0x6f22,  0x5b57};
+        0x82, 0xa9, 0x82, 0x20, 0x61, 0x8a, 0xbf, 0x8e, 0x9a };
+    static const UChar toUnicode943sub[] = { 0x304b, 0x1a, 0x20, 0x0061, 0x6f22,  0x5b57 };
+    static const UChar toUnicode943skip[]= { 0x304b, 0x20, 0x0061, 0x6f22,  0x5b57 };
     static const UChar toUnicode943stop[]= { 0x304b};
 
     static const UChar toUnicode943stop[]= { 0x304b};
 
-    static const int32_t  fromIBM943Offssub[]  = {0, 2, 4, 5, 7};
-    static const int32_t  fromIBM943Offsskip[] = { 0, 4, 5, 7};
+    static const int32_t  fromIBM943Offssub[]  = { 0, 2, 3, 4, 5, 7 };
+    static const int32_t  fromIBM943Offsskip[] = { 0, 3, 4, 5, 7 };
     static const int32_t  fromIBM943Offsstop[] = { 0};
 
     gInBufferSize = inputsize;
     static const int32_t  fromIBM943Offsstop[] = { 0};
 
     gInBufferSize = inputsize;
@@ -2707,9 +2575,9 @@ static void TestSingleByte(int32_t inputsize, int32_t outputsize)
 {
     static const uint8_t sampleText[] = {
         0x82, 0xa9, 0x61, 0x62, 0x63 , 0x82,
 {
     static const uint8_t sampleText[] = {
         0x82, 0xa9, 0x61, 0x62, 0x63 , 0x82,
-        0xff, /*0x82, 0xa9,*/ 0x32, 0x33};
-    static const UChar toUnicode943sub[] = {0x304b, 0x0061, 0x0062, 0x0063,  0xfffd,/*0x304b,*/ 0x0032, 0x0033};
-    static const int32_t  fromIBM943Offssub[]  = {0, 2, 3, 4, 5, 7, 8};
+        0xff, 0x32, 0x33};
+    static const UChar toUnicode943sub[] = { 0x304b, 0x0061, 0x0062, 0x0063, 0x1a, 0x1a, 0x0032, 0x0033 };
+    static const int32_t fromIBM943Offssub[] = { 0, 2, 3, 4, 5, 6, 7, 8 };
     /*checking illegal value for ibm-943 with substitute*/ 
     gInBufferSize = inputsize;
     gOutBufferSize = outputsize;
     /*checking illegal value for ibm-943 with substitute*/ 
     gInBufferSize = inputsize;
     gOutBufferSize = outputsize;
@@ -2746,8 +2614,7 @@ static void TestEBCDIC_STATEFUL_Sub(int32_t inputsize, int32_t outputsize)
         UCNV_FROM_U_CALLBACK_SUBSTITUTE, offset_930_subvaried, mySubChar, 1 ))
             log_err("u-> ibm-930(EBCDIC_STATEFUL) with subst(setSubChar=0x3f) did not match.\n");
 }
         UCNV_FROM_U_CALLBACK_SUBSTITUTE, offset_930_subvaried, mySubChar, 1 ))
             log_err("u-> ibm-930(EBCDIC_STATEFUL) with subst(setSubChar=0x3f) did not match.\n");
 }
-
-
+#endif
 
 UBool testConvertFromUnicode(const UChar *source, int sourceLen,  const uint8_t *expect, int expectLen, 
                 const char *codepage, UConverterFromUCallback callback , const int32_t *expectOffsets, 
 
 UBool testConvertFromUnicode(const UChar *source, int sourceLen,  const uint8_t *expect, int expectLen, 
                 const char *codepage, UConverterFromUCallback callback , const int32_t *expectOffsets, 
@@ -2757,28 +2624,28 @@ UBool testConvertFromUnicode(const UChar *source, int sourceLen,  const uint8_t
 
     UErrorCode status = U_ZERO_ERROR;
     UConverter *conv = 0;
 
     UErrorCode status = U_ZERO_ERROR;
     UConverter *conv = 0;
-    uint8_t junkout[NEW_MAX_BUFFER]; /* FIX */
+    char junkout[NEW_MAX_BUFFER]; /* FIX */
     int32_t junokout[NEW_MAX_BUFFER]; /* FIX */
     const UChar *src;
     int32_t junokout[NEW_MAX_BUFFER]; /* FIX */
     const UChar *src;
-    uint8_t *end;
-    uint8_t *targ;
+    char *end;
+    char *targ;
     int32_t *offs;
     int i;
     int32_t  realBufferSize;
     int32_t *offs;
     int i;
     int32_t  realBufferSize;
-    uint8_t *realBufferEnd;
+    char *realBufferEnd;
     const UChar *realSourceEnd;
     const UChar *sourceLimit;
     UBool checkOffsets = TRUE;
     UBool doFlush;
     char junk[9999];
     char offset_str[9999];
     const UChar *realSourceEnd;
     const UChar *sourceLimit;
     UBool checkOffsets = TRUE;
     UBool doFlush;
     char junk[9999];
     char offset_str[9999];
-    uint8_t *p;
+    char *p;
     UConverterFromUCallback oldAction = NULL;
     const void* oldContext = NULL;
 
 
     for(i=0;i<NEW_MAX_BUFFER;i++)
     UConverterFromUCallback oldAction = NULL;
     const void* oldContext = NULL;
 
 
     for(i=0;i<NEW_MAX_BUFFER;i++)
-        junkout[i] = 0xF0;
+        junkout[i] = (char)0xF0;
     for(i=0;i<NEW_MAX_BUFFER;i++)
         junokout[i] = 0xFF;
     setNuConvTestName(codepage, "FROM");
     for(i=0;i<NEW_MAX_BUFFER;i++)
         junokout[i] = 0xFF;
     setNuConvTestName(codepage, "FROM");
@@ -2857,14 +2724,11 @@ UBool testConvertFromUnicode(const UChar *source, int sourceLen,  const uint8_t
         UChar errChars[50]; /* should be sufficient */
         int8_t errLen = 50;
         UErrorCode err = U_ZERO_ERROR;
         UChar errChars[50]; /* should be sufficient */
         int8_t errLen = 50;
         UErrorCode err = U_ZERO_ERROR;
-        const UChar* limit= NULL;
         const UChar* start= NULL;
         ucnv_getInvalidUChars(conv,errChars, &errLen, &err);
         if(U_FAILURE(err)){
             log_err("ucnv_getInvalidUChars failed with error : %s\n",u_errorName(err));
         }
         const UChar* start= NULL;
         ucnv_getInvalidUChars(conv,errChars, &errLen, &err);
         if(U_FAILURE(err)){
             log_err("ucnv_getInvalidUChars failed with error : %s\n",u_errorName(err));
         }
-        /* src points to limit of invalid chars */
-        limit = src;
         /* length of in invalid chars should be equal to returned length*/
         start = src - errLen;
         if(u_strncmp(errChars,start,errLen)!=0){
         /* length of in invalid chars should be equal to returned length*/
         start = src - errLen;
         if(u_strncmp(errChars,start,errLen)!=0){
@@ -2881,7 +2745,7 @@ UBool testConvertFromUnicode(const UChar *source, int sourceLen,  const uint8_t
 
     log_verbose("\nConversion done [%d uchars in -> %d chars out]. \nResult :",
         sourceLen, targ-junkout);
 
     log_verbose("\nConversion done [%d uchars in -> %d chars out]. \nResult :",
         sourceLen, targ-junkout);
-    if(VERBOSITY)
+    if(getTestOption(VERBOSITY_OPTION))
     {
 
         junk[0] = 0;
     {
 
         junk[0] = 0;
@@ -2908,7 +2772,7 @@ UBool testConvertFromUnicode(const UChar *source, int sourceLen,  const uint8_t
     {
         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);
     {
         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);
-        printSeqErr(junkout, targ-junkout);
+        printSeqErr((const uint8_t *)junkout, (int32_t)(targ-junkout));
         printSeqErr(expect, expectLen);
         return FALSE;
     }
         printSeqErr(expect, expectLen);
         return FALSE;
     }
@@ -2919,7 +2783,7 @@ UBool testConvertFromUnicode(const UChar *source, int sourceLen,  const uint8_t
         if(memcmp(junokout,expectOffsets,(targ-junkout) * sizeof(int32_t) )){
             log_err("did not get the expected offsets while %s \n", gNuConvTestName);
             log_err("Got Output : ");
         if(memcmp(junokout,expectOffsets,(targ-junkout) * sizeof(int32_t) )){
             log_err("did not get the expected offsets while %s \n", gNuConvTestName);
             log_err("Got Output : ");
-            printSeqErr(junkout, targ-junkout);
+            printSeqErr((const uint8_t *)junkout, (int32_t)(targ-junkout));
             log_err("Got Offsets:      ");
             for(p=junkout;p<targ;p++)
                 log_err("%d,", junokout[p-junkout]); 
             log_err("Got Offsets:      ");
             for(p=junkout;p<targ;p++)
                 log_err("%d,", junokout[p-junkout]); 
@@ -2943,7 +2807,7 @@ UBool testConvertFromUnicode(const UChar *source, int sourceLen,  const uint8_t
         log_err("source: ");
         printUSeqErr(source, sourceLen);
         log_err("Got:      ");
         log_err("source: ");
         printUSeqErr(source, sourceLen);
         log_err("Got:      ");
-        printSeqErr(junkout, expectLen);
+        printSeqErr((const uint8_t *)junkout, expectLen);
         log_err("Expected: ");
         printSeqErr(expect, expectLen);
         return FALSE;
         log_err("Expected: ");
         printSeqErr(expect, expectLen);
         return FALSE;
@@ -2958,9 +2822,9 @@ UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *e
     UConverter *conv = 0;
     UChar   junkout[NEW_MAX_BUFFER]; /* FIX */
     int32_t junokout[NEW_MAX_BUFFER]; /* FIX */
     UConverter *conv = 0;
     UChar   junkout[NEW_MAX_BUFFER]; /* FIX */
     int32_t junokout[NEW_MAX_BUFFER]; /* FIX */
-    const uint8_t *src;
-    const uint8_t *realSourceEnd;
-    const uint8_t *srcLimit;
+    const char *src;
+    const char *realSourceEnd;
+    const char *srcLimit;
     UChar *targ;
     UChar *end;
     int32_t *offs;
     UChar *targ;
     UChar *end;
     int32_t *offs;
@@ -2995,7 +2859,7 @@ UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *e
 
     log_verbose("Converter opened..\n");
 
 
     log_verbose("Converter opened..\n");
 
-    src = source;
+    src = (const char *)source;
     targ = junkout;
     offs = junokout;
 
     targ = junkout;
     offs = junokout;
 
@@ -3055,17 +2919,14 @@ UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *e
         char errChars[50]; /* should be sufficient */
         int8_t errLen = 50;
         UErrorCode err = U_ZERO_ERROR;
         char errChars[50]; /* should be sufficient */
         int8_t errLen = 50;
         UErrorCode err = U_ZERO_ERROR;
-        const uint8_t* limit= NULL;
-        const uint8_t* start= NULL;
+        const char* start= NULL;
         ucnv_getInvalidChars(conv,errChars, &errLen, &err);
         if(U_FAILURE(err)){
             log_err("ucnv_getInvalidChars failed with error : %s\n",u_errorName(err));
         }
         ucnv_getInvalidChars(conv,errChars, &errLen, &err);
         if(U_FAILURE(err)){
             log_err("ucnv_getInvalidChars failed with error : %s\n",u_errorName(err));
         }
-        /* src points to limit of invalid chars */
-        limit = src;
         /* length of in invalid chars should be equal to returned length*/
         start = src - errLen;
         /* length of in invalid chars should be equal to returned length*/
         start = src - errLen;
-        if(uprv_strncmp(errChars,(char*)start,errLen)!=0){
+        if(uprv_strncmp(errChars,start,errLen)!=0){
             log_err("ucnv_getInvalidChars did not return the correct invalid chars for encoding %s \n", ucnv_getName(conv,&err));
         }
     }
             log_err("ucnv_getInvalidChars did not return the correct invalid chars for encoding %s \n", ucnv_getName(conv,&err));
         }
     }
@@ -3079,7 +2940,7 @@ UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *e
 
     log_verbose("\nConversion done. %d bytes -> %d chars.\nResult :",
         sourcelen, targ-junkout);
 
     log_verbose("\nConversion done. %d bytes -> %d chars.\nResult :",
         sourcelen, targ-junkout);
-    if(VERBOSITY)
+    if(getTestOption(VERBOSITY_OPTION))
     {
 
         junk[0] = 0;
     {
 
         junk[0] = 0;
@@ -3122,7 +2983,7 @@ UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *e
                 log_err("0x%04x,", junkout[i]);
             log_err("\n");
             log_err("From source:      ");
                 log_err("0x%04x,", junkout[i]);
             log_err("\n");
             log_err("From source:      ");
-            for(i=0; i<(src-source); i++)
+            for(i=0; i<(src-(const char *)source); i++)
                 log_err("  0x%02x,", (unsigned char)source[i]);
             log_err("\n");
         }
                 log_err("  0x%02x,", (unsigned char)source[i]);
             log_err("\n");
         }
@@ -3154,28 +3015,28 @@ UBool testConvertFromUnicodeWithContext(const UChar *source, int sourceLen,  con
 
     UErrorCode status = U_ZERO_ERROR;
     UConverter *conv = 0;
 
     UErrorCode status = U_ZERO_ERROR;
     UConverter *conv = 0;
-    uint8_t junkout[NEW_MAX_BUFFER]; /* FIX */
+    char junkout[NEW_MAX_BUFFER]; /* FIX */
     int32_t junokout[NEW_MAX_BUFFER]; /* FIX */
     const UChar *src;
     int32_t junokout[NEW_MAX_BUFFER]; /* FIX */
     const UChar *src;
-    uint8_t *end;
-    uint8_t *targ;
+    char *end;
+    char *targ;
     int32_t *offs;
     int i;
     int32_t  realBufferSize;
     int32_t *offs;
     int i;
     int32_t  realBufferSize;
-    uint8_t *realBufferEnd;
+    char *realBufferEnd;
     const UChar *realSourceEnd;
     const UChar *sourceLimit;
     UBool checkOffsets = TRUE;
     UBool doFlush;
     char junk[9999];
     char offset_str[9999];
     const UChar *realSourceEnd;
     const UChar *sourceLimit;
     UBool checkOffsets = TRUE;
     UBool doFlush;
     char junk[9999];
     char offset_str[9999];
-    uint8_t *p;
+    char *p;
     UConverterFromUCallback oldAction = NULL;
     const void* oldContext = NULL;
 
 
     for(i=0;i<NEW_MAX_BUFFER;i++)
     UConverterFromUCallback oldAction = NULL;
     const void* oldContext = NULL;
 
 
     for(i=0;i<NEW_MAX_BUFFER;i++)
-        junkout[i] = 0xF0;
+        junkout[i] = (char)0xF0;
     for(i=0;i<NEW_MAX_BUFFER;i++)
         junokout[i] = 0xFF;
     setNuConvTestName(codepage, "FROM");
     for(i=0;i<NEW_MAX_BUFFER;i++)
         junokout[i] = 0xFF;
     setNuConvTestName(codepage, "FROM");
@@ -3258,7 +3119,7 @@ UBool testConvertFromUnicodeWithContext(const UChar *source, int sourceLen,  con
 
     log_verbose("\nConversion done [%d uchars in -> %d chars out]. \nResult :",
         sourceLen, targ-junkout);
 
     log_verbose("\nConversion done [%d uchars in -> %d chars out]. \nResult :",
         sourceLen, targ-junkout);
-    if(VERBOSITY)
+    if(getTestOption(VERBOSITY_OPTION))
     {
 
         junk[0] = 0;
     {
 
         junk[0] = 0;
@@ -3285,7 +3146,7 @@ UBool testConvertFromUnicodeWithContext(const UChar *source, int sourceLen,  con
     {
         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);
     {
         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);
-        printSeqErr(junkout, targ-junkout);
+        printSeqErr((const uint8_t *)junkout, (int32_t)(targ-junkout));
         printSeqErr(expect, expectLen);
         return FALSE;
     }
         printSeqErr(expect, expectLen);
         return FALSE;
     }
@@ -3296,7 +3157,7 @@ UBool testConvertFromUnicodeWithContext(const UChar *source, int sourceLen,  con
         if(memcmp(junokout,expectOffsets,(targ-junkout) * sizeof(int32_t) )){
             log_err("did not get the expected offsets while %s \n", gNuConvTestName);
             log_err("Got Output : ");
         if(memcmp(junokout,expectOffsets,(targ-junkout) * sizeof(int32_t) )){
             log_err("did not get the expected offsets while %s \n", gNuConvTestName);
             log_err("Got Output : ");
-            printSeqErr(junkout, targ-junkout);
+            printSeqErr((const uint8_t *)junkout, (int32_t)(targ-junkout));
             log_err("Got Offsets:      ");
             for(p=junkout;p<targ;p++)
                 log_err("%d,", junokout[p-junkout]); 
             log_err("Got Offsets:      ");
             for(p=junkout;p<targ;p++)
                 log_err("%d,", junokout[p-junkout]); 
@@ -3320,7 +3181,7 @@ UBool testConvertFromUnicodeWithContext(const UChar *source, int sourceLen,  con
         log_err("source: ");
         printUSeqErr(source, sourceLen);
         log_err("Got:      ");
         log_err("source: ");
         printUSeqErr(source, sourceLen);
         log_err("Got:      ");
-        printSeqErr(junkout, expectLen);
+        printSeqErr((const uint8_t *)junkout, expectLen);
         log_err("Expected: ");
         printSeqErr(expect, expectLen);
         return FALSE;
         log_err("Expected: ");
         printSeqErr(expect, expectLen);
         return FALSE;
@@ -3334,9 +3195,9 @@ UBool testConvertToUnicodeWithContext( const uint8_t *source, int sourcelen, con
     UConverter *conv = 0;
     UChar   junkout[NEW_MAX_BUFFER]; /* FIX */
     int32_t junokout[NEW_MAX_BUFFER]; /* FIX */
     UConverter *conv = 0;
     UChar   junkout[NEW_MAX_BUFFER]; /* FIX */
     int32_t junokout[NEW_MAX_BUFFER]; /* FIX */
-    const uint8_t *src;
-    const uint8_t *realSourceEnd;
-    const uint8_t *srcLimit;
+    const char *src;
+    const char *realSourceEnd;
+    const char *srcLimit;
     UChar *targ;
     UChar *end;
     int32_t *offs;
     UChar *targ;
     UChar *end;
     int32_t *offs;
@@ -3371,7 +3232,7 @@ UBool testConvertToUnicodeWithContext( const uint8_t *source, int sourcelen, con
 
     log_verbose("Converter opened..\n");
 
 
     log_verbose("Converter opened..\n");
 
-    src = source;
+    src = (const char *)source;
     targ = junkout;
     offs = junokout;
 
     targ = junkout;
     offs = junokout;
 
@@ -3436,7 +3297,7 @@ UBool testConvertToUnicodeWithContext( const uint8_t *source, int sourcelen, con
 
     log_verbose("\nConversion done. %d bytes -> %d chars.\nResult :",
         sourcelen, targ-junkout);
 
     log_verbose("\nConversion done. %d bytes -> %d chars.\nResult :",
         sourcelen, targ-junkout);
-    if(VERBOSITY)
+    if(getTestOption(VERBOSITY_OPTION))
     {
 
         junk[0] = 0;
     {
 
         junk[0] = 0;
@@ -3479,7 +3340,7 @@ UBool testConvertToUnicodeWithContext( const uint8_t *source, int sourcelen, con
                 log_err("0x%04x,", junkout[i]);
             log_err("\n");
             log_err("From source:      ");
                 log_err("0x%04x,", junkout[i]);
             log_err("\n");
             log_err("From source:      ");
-            for(i=0; i<(src-source); i++)
+            for(i=0; i<(src-(const char *)source); i++)
                 log_err("  0x%02x,", (unsigned char)source[i]);
             log_err("\n");
         }
                 log_err("  0x%02x,", (unsigned char)source[i]);
             log_err("\n");
         }
@@ -3502,3 +3363,23 @@ UBool testConvertToUnicodeWithContext( const uint8_t *source, int sourcelen, con
         return FALSE;
     }
 }
         return FALSE;
     }
 }
+
+static void TestCallBackFailure(void) {
+    UErrorCode status = U_USELESS_COLLATOR_ERROR;
+    ucnv_cbFromUWriteBytes(NULL, NULL, -1, -1, &status);
+    if (status != U_USELESS_COLLATOR_ERROR) {
+        log_err("Error: ucnv_cbFromUWriteBytes did not react correctly to a bad UErrorCode\n");
+    }
+    ucnv_cbFromUWriteUChars(NULL, NULL, NULL, -1, &status);
+    if (status != U_USELESS_COLLATOR_ERROR) {
+        log_err("Error: ucnv_cbFromUWriteUChars did not react correctly to a bad UErrorCode\n");
+    }
+    ucnv_cbFromUWriteSub(NULL, -1, &status);
+    if (status != U_USELESS_COLLATOR_ERROR) {
+        log_err("Error: ucnv_cbFromUWriteSub did not react correctly to a bad UErrorCode\n");
+    }
+    ucnv_cbToUWriteUChars(NULL, NULL, -1, -1, &status);
+    if (status != U_USELESS_COLLATOR_ERROR) {
+        log_err("Error: ucnv_cbToUWriteUChars did not react correctly to a bad UErrorCode\n");
+    }
+}