test/jdk/sun/nio/cs/TestMS5022X.java
changeset 47216 71c04702a3d5
parent 44115 bb4e971bf5d4
child 58080 931799bfbc10
equal deleted inserted replaced
47215:4ebc2e2fb97c 47216:71c04702a3d5
       
     1 /*
       
     2  * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  */
       
    23 
       
    24 /* @test
       
    25  * @bug 6173388 6319716
       
    26  * @summary Check full coverage encode/decode for Microsoft
       
    27  *          ISO2022_JP variants MS50220, MS50221 and MSISO2022JP
       
    28  * @modules jdk.charsets
       
    29  */
       
    30 
       
    31 import java.io.*;
       
    32 import java.nio.charset.*;
       
    33 public class TestMS5022X {
       
    34 
       
    35     private static String US_ASCII =
       
    36         "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" +
       
    37         "\b\t\n\u000B\f\r" +
       
    38         "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" +
       
    39         "\u0018\u0019\u001A\u001C\u001D\u001E\u001F" +
       
    40         "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" +
       
    41         "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" +
       
    42         "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" +
       
    43         "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" +
       
    44         "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" +
       
    45         "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" +
       
    46         "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" +
       
    47         "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" +
       
    48         "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" +
       
    49         "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" +
       
    50         "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" +
       
    51         "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u00A5\u203E";
       
    52 
       
    53      // Subset of chars sourced from JISX0208:1983
       
    54 
       
    55      private static String JISX0208SUBSET =
       
    56         "\u3000\u3001\u3002\uFF0C\uFF0E\u30FB\uFF1A" +
       
    57         "\uFF1B\uFF1F\uFF01\u309B\u309C\u00B4\uFF40\u00A8" +
       
    58         "\uFF3E\uFFE3\uFF3F\u30FD\u30FE\u309D\u309E\u3003" +
       
    59         "\u4EDD\u3005\u3006\u3007\u30FC\u2015\u2010\uFF0F" +    //u2014->u2015
       
    60         "\uFF3C\u301C\u2016\uFF5C\u2026\u2025\u2018\u2019" +
       
    61         "\u5C05\u5C07\u5C08\u5C0D\u5C13\u5C20\u5C22\u5C28" +
       
    62         "\u5C38\u5C39\u5C41\u5C46\u5C4E\u5C53\u5C50\u5C4F" +
       
    63         "\u5B71\u5C6C\u5C6E\u4E62\u5C76\u5C79\u5C8C\u5C91" +
       
    64         "\u5C94\u599B\u5CAB\u5CBB\u5CB6\u5CBC\u5CB7\u5CC5" +
       
    65         "\u5CBE\u5CC7\u5CD9\u5CE9\u5CFD\u5CFA\u5CED\u5D8C" +
       
    66         "\u5CEA\u5D0B\u5D15\u5D17\u5D5C\u5D1F\u5D1B\u5D11" +
       
    67         "\u5D14\u5D22\u5D1A\u5D19\u5D18\u5D4C\u5D52\u5D4E" +
       
    68         "\u5D4B\u5D6C\u5D73\u5D76\u5D87\u5D84\u5D82\u5DA2" +
       
    69         "\u5D9D\u5DAC\u5DAE\u5DBD\u5D90\u5DB7\u5DBC\u5DC9" +
       
    70         "\u5DCD\u5DD3\u5DD2\u5DD6\u5DDB\u5DEB\u5DF2\u5DF5" +
       
    71         "\u5E0B\u5E1A\u5E19\u5E11\u5E1B\u5E36\u5E37\u5E44" +
       
    72         "\u5E43\u5E40\u5E4E\u5E57\u5E54\u5E5F\u5E62\u5E64" +
       
    73         "\u5E47\u5E75\u5E76\u5E7A\u9EBC\u5E7F\u5EA0\u5EC1" +
       
    74         "\u5EC2\u5EC8\u5ED0\u5ECF\u5ED6\u5EE3\u5EDD\u5EDA" +
       
    75         "\u5EDB\u5EE2\u5EE1\u5EE8\u5EE9\u5EEC\u5EF1\u5EF3" +
       
    76         "\u5EF0\u5EF4\u5EF8\u5EFE\u5F03\u5F09\u5F5D\u5F5C" +
       
    77         "\u5F0B\u5F11\u5F16\u5F29\u5F2D\u5F38\u5F41\u5F48" +
       
    78         "\u5F4C\u5F4E\u5F2F\u5F51\u5F56\u5F57\u5F59\u5F61" +
       
    79         "\u5F6D\u5F73\u5F77\u5F83\u5F82\u5F7F\u5F8A\u5F88" +
       
    80         "\u5F91\u5F87\u5F9E\u5F99\u5F98\u5FA0\u5FA8\u5FAD" +
       
    81         "\u5FBC\u5FD6\u5FFB\u5FE4\u5FF8\u5FF1\u5FDD\u60B3" +
       
    82         "\u5FFF\u6021\u6060\u6019\u6010\u6029\u600E\u6031" +
       
    83         "\u62EE\u62F1\u6327\u6302\u6308\u62EF\u62F5\u6350" +
       
    84         "\u633E\u634D\u641C\u634F\u6396\u638E\u6380\u63AB" +
       
    85         "\u6376\u63A3\u638F\u6389\u639F\u63B5\u636B\u6369" +
       
    86         "\u63BE\u63E9\u63C0\u63C6\u63E3\u63C9\u63D2\u63F6" +
       
    87         "\u63C4\u6416\u6434\u6406\u6413\u6426\u6436\u651D" +
       
    88         "\u6417\u6428\u640F\u6467\u646F\u6476\u644E\u652A" +
       
    89         "\u6495\u6493\u64A5\u64A9\u6488\u64BC\u64DA\u64D2" +
       
    90         "\u64C5\u64C7\u64BB\u64D8\u64C2\u64F1\u64E7\u8209" +
       
    91         "\u64E0\u64E1\u62AC\u64E3\u64EF\u652C\u64F6\u64F4" +
       
    92         "\u64F2\u64FA\u6500\u64FD\u6518\u651C\u6505\u6524" +
       
    93         "\u6523\u652B\u6534\u6535\u6537\u6536\u6538\u754B" +
       
    94         "\u6741\u6738\u6737\u6746\u675E\u6760\u6759\u6763" +
       
    95         "\u6764\u6789\u6770\u67A9\u677C\u676A\u678C\u678B" +
       
    96         "\u67A6\u67A1\u6785\u67B7\u67EF\u67B4\u67EC\u67B3" +
       
    97         "\u67E9\u67B8\u67E4\u67DE\u67DD\u67E2\u67EE\u67B9" +
       
    98         "\u67CE\u67C6\u67E7\u6A9C\u681E\u6846\u6829\u6840" +
       
    99         "\u684D\u6832\u684E\u68B3\u682B\u6859\u6863\u6877" +
       
   100         "\u687F\u689F\u688F\u68AD\u6894\u689D\u689B\u6883" +
       
   101         "\u6AAE\u68B9\u6874\u68B5\u68A0\u68BA\u690F\u688D" +
       
   102         "\u687E\u6901\u68CA\u6908\u68D8\u6922\u6926\u68E1" +
       
   103         "\u690C\u68CD\u68D4\u68E7\u68D5\u6936\u6912\u6904" +
       
   104         "\u68D7\u68E3\u6925\u68F9\u68E0\u68EF\u6928\u692A" +
       
   105         "\u691A\u6923\u6921\u68C6\u6979\u6977\u695C\u6978" +
       
   106         "\u6CD7\u6CC5\u6CDD\u6CAE\u6CB1\u6CBE\u6CBA\u6CDB" +
       
   107         "\u6CEF\u6CD9\u6CEA\u6D1F\u884D\u6D36\u6D2B\u6D3D" +
       
   108         "\u6D38\u6D19\u6D35\u6D33\u6D12\u6D0C\u6D63\u6D93" +
       
   109         "\u6D64\u6D5A\u6D79\u6D59\u6D8E\u6D95\u6FE4\u6D85" +
       
   110         "\u6DF9\u6E15\u6E0A\u6DB5\u6DC7\u6DE6\u6DB8\u6DC6" +
       
   111         "\u6DEC\u6DDE\u6DCC\u6DE8\u6DD2\u6DC5\u6DFA\u6DD9" +
       
   112         "\u724B\u7258\u7274\u727E\u7282\u7281\u7287\u7292" +
       
   113         "\u7296\u72A2\u72A7\u72B9\u72B2\u72C3\u72C6\u72C4" +
       
   114         "\u9D59\u9D72\u9D89\u9D87\u9DAB\u9D6F\u9D7A\u9D9A" +
       
   115         "\u9DA4\u9DA9\u9DB2\u9DC4\u9DC1\u9DBB\u9DB8\u9DBA" +
       
   116         "\u9DC6\u9DCF\u9DC2\u9DD9\u9DD3\u9DF8\u9DE6\u9DED" +
       
   117         "\u9DEF\u9DFD\u9E1A\u9E1B\u9E1E\u9E75\u9E79\u9E7D" +
       
   118         "\u9E81\u9E88\u9E8B\u9E8C\u9E92\u9E95\u9E91\u9E9D" +
       
   119         "\u9EA5\u9EA9\u9EB8\u9EAA\u9EAD\u9761\u9ECC\u9ECE" +
       
   120         "\u9ECF\u9ED0\u9ED4\u9EDC\u9EDE\u9EDD\u9EE0\u9EE5" +
       
   121         "\u9EE8\u9EEF\u9EF4\u9EF6\u9EF7\u9EF9\u9EFB\u9EFC" +
       
   122         "\u9EFD\u9F07\u9F08\u76B7\u9F15\u9F21\u9F2C\u9F3E" +
       
   123         "\u9F4A\u9F52\u9F54\u9F63\u9F5F\u9F60\u9F61\u9F66" +
       
   124         "\u9F67\u9F6C\u9F6A\u9F77\u9F72\u9F76\u9F95\u9F9C" +
       
   125         "\u9FA0\u582F\u69C7\u9059\u7464\u51DC\u7199";
       
   126 
       
   127     private static String JISX0201KATAKANA =
       
   128         "\uFF61\uFF62\uFF63\uFF64" +
       
   129         "\uFF65\uFF66\uFF67\uFF68\uFF69\uFF6A\uFF6B\uFF6C" +
       
   130         "\uFF6D\uFF6E\uFF6F\uFF70\uFF71\uFF72\uFF73\uFF74" +
       
   131         "\uFF75\uFF76\uFF77\uFF78\uFF79\uFF7A\uFF7B\uFF7C" +
       
   132         "\uFF7D\uFF7E\uFF7F\uFF80\uFF81\uFF82\uFF83\uFF84" +
       
   133         "\uFF85\uFF86\uFF87\uFF88\uFF89\uFF8A\uFF8B\uFF8C" +
       
   134         "\uFF8D\uFF8E\uFF8F\uFF90\uFF91\uFF92\uFF93\uFF94" +
       
   135         "\uFF95\uFF96\uFF97\uFF98\uFF99\uFF9A\uFF9B\uFF9C" +
       
   136         "\uFF9D\uFF9E\uFF9F";
       
   137 
       
   138     private static String JISX0208NECROW13 =
       
   139         "\u2460\u2461\u2462\u2463\u2464\u2465\u2466\u2467" +
       
   140         "\u2468\u2469\u246A\u246B\u246C\u246D\u246E\u246F" +
       
   141         "\u2470\u2471\u2472\u2473\u2160\u2161\u2162\u2163" +
       
   142         "\u2164\u2165\u2166\u2167\u2168\u2169\u3349\u3314" +
       
   143         "\u3322\u334D\u3318\u3327\u3303\u3336\u3351\u3357" +
       
   144         "\u330D\u3326\u3323\u332B\u334A\u333B\u339C\u339D" +
       
   145         "\u339E\u338E\u338F\u33C4\u33A1\u337B\u301E\u301F" +
       
   146         "\u2116\u33CD\u2121\u32A4\u32A5\u32A6\u32A7\u32A8" +
       
   147         "\u3231\u3232\u3239\u337E\u337D\u337C" +
       
   148         "\u222e\u2211\u221f\u22bf";
       
   149 
       
   150     private static byte[] expectedBytes_US_ASCII = {
       
   151         (byte)0x0, (byte)0x1, (byte)0x2, (byte)0x3,
       
   152         (byte)0x4, (byte)0x5, (byte)0x6, (byte)0x7,
       
   153         (byte)0x8, (byte)0x9, (byte)0xa, (byte)0xb,
       
   154         (byte)0xc, (byte)0xd,
       
   155         (byte)0x10, (byte)0x11, (byte)0x12, (byte)0x13,
       
   156         (byte)0x14, (byte)0x15, (byte)0x16, (byte)0x17,
       
   157         (byte)0x18, (byte)0x19, (byte)0x1a,
       
   158         (byte)0x1c, (byte)0x1d, (byte)0x1e, (byte)0x1f,
       
   159         (byte)0x20, (byte)0x21, (byte)0x22, (byte)0x23,
       
   160         (byte)0x24, (byte)0x25, (byte)0x26, (byte)0x27,
       
   161         (byte)0x28, (byte)0x29, (byte)0x2a, (byte)0x2b,
       
   162         (byte)0x2c, (byte)0x2d, (byte)0x2e, (byte)0x2f,
       
   163         (byte)0x30, (byte)0x31, (byte)0x32, (byte)0x33,
       
   164         (byte)0x34, (byte)0x35, (byte)0x36, (byte)0x37,
       
   165         (byte)0x38, (byte)0x39, (byte)0x3a, (byte)0x3b,
       
   166         (byte)0x3c, (byte)0x3d, (byte)0x3e, (byte)0x3f,
       
   167         (byte)0x40, (byte)0x41, (byte)0x42, (byte)0x43,
       
   168         (byte)0x44, (byte)0x45, (byte)0x46, (byte)0x47,
       
   169         (byte)0x48, (byte)0x49, (byte)0x4a, (byte)0x4b,
       
   170         (byte)0x4c, (byte)0x4d, (byte)0x4e, (byte)0x4f,
       
   171         (byte)0x50, (byte)0x51, (byte)0x52, (byte)0x53,
       
   172         (byte)0x54, (byte)0x55, (byte)0x56, (byte)0x57,
       
   173         (byte)0x58, (byte)0x59, (byte)0x5a, (byte)0x5b,
       
   174         (byte)0x5c, (byte)0x5d, (byte)0x5e, (byte)0x5f,
       
   175         (byte)0x60, (byte)0x61, (byte)0x62, (byte)0x63,
       
   176         (byte)0x64, (byte)0x65, (byte)0x66, (byte)0x67,
       
   177         (byte)0x68, (byte)0x69, (byte)0x6a, (byte)0x6b,
       
   178         (byte)0x6c, (byte)0x6d, (byte)0x6e, (byte)0x6f,
       
   179         (byte)0x70, (byte)0x71, (byte)0x72, (byte)0x73,
       
   180         (byte)0x74, (byte)0x75, (byte)0x76, (byte)0x77,
       
   181         (byte)0x78, (byte)0x79, (byte)0x7a, (byte)0x7b,
       
   182         (byte)0x7c, (byte)0x7d, (byte)0x7e, (byte)0x1b,
       
   183         (byte)0x28, (byte)0x4a, (byte)0x5c, (byte)0x7e
       
   184     };
       
   185 
       
   186     private static byte[] expectedBytes_JISX0208SUBSET =
       
   187     {
       
   188         (byte)0x1b, (byte)0x24, (byte)0x42, (byte)0x21,
       
   189         (byte)0x21, (byte)0x21,
       
   190         (byte)0x22, (byte)0x21, (byte)0x23, (byte)0x21,
       
   191         (byte)0x24, (byte)0x21, (byte)0x25, (byte)0x21,
       
   192         (byte)0x26, (byte)0x21, (byte)0x27, (byte)0x21,
       
   193         (byte)0x28, (byte)0x21, (byte)0x29, (byte)0x21,
       
   194         (byte)0x2a, (byte)0x21, (byte)0x2b, (byte)0x21,
       
   195         (byte)0x2c, (byte)0x21, (byte)0x2d, (byte)0x21,
       
   196         (byte)0x2e, (byte)0x21, (byte)0x2f, (byte)0x21,
       
   197         (byte)0x30, (byte)0x21, (byte)0x31, (byte)0x21,
       
   198         (byte)0x32, (byte)0x21, (byte)0x33, (byte)0x21,
       
   199         (byte)0x34, (byte)0x21, (byte)0x35, (byte)0x21,
       
   200         (byte)0x36, (byte)0x21, (byte)0x37, (byte)0x21,
       
   201         (byte)0x38, (byte)0x21, (byte)0x39, (byte)0x21,
       
   202         (byte)0x3a, (byte)0x21, (byte)0x3b, (byte)0x21,
       
   203         (byte)0x3c, (byte)0x21, (byte)0x3d, (byte)0x21,
       
   204         (byte)0x3e, (byte)0x21, (byte)0x3f, (byte)0x21,
       
   205         (byte)0x40, (byte)0x21, (byte)0x41, (byte)0x21,
       
   206         (byte)0x42, (byte)0x21, (byte)0x43, (byte)0x21,
       
   207         (byte)0x44, (byte)0x21, (byte)0x45, (byte)0x21,
       
   208         (byte)0x46, (byte)0x21, (byte)0x47, (byte)0x55,
       
   209         (byte)0x71, (byte)0x55, (byte)0x72, (byte)0x55,
       
   210         (byte)0x73, (byte)0x55, (byte)0x74, (byte)0x55,
       
   211         (byte)0x75, (byte)0x55, (byte)0x76, (byte)0x55,
       
   212         (byte)0x77, (byte)0x55, (byte)0x78, (byte)0x55,
       
   213         (byte)0x79, (byte)0x55, (byte)0x7a, (byte)0x55,
       
   214         (byte)0x7b, (byte)0x55, (byte)0x7c, (byte)0x55,
       
   215         (byte)0x7d, (byte)0x55, (byte)0x7e, (byte)0x56,
       
   216         (byte)0x21, (byte)0x56, (byte)0x22, (byte)0x56,
       
   217         (byte)0x23, (byte)0x56, (byte)0x24, (byte)0x56,
       
   218         (byte)0x25, (byte)0x56, (byte)0x26, (byte)0x56,
       
   219         (byte)0x27, (byte)0x56, (byte)0x28, (byte)0x56,
       
   220         (byte)0x29, (byte)0x56, (byte)0x2a, (byte)0x56,
       
   221         (byte)0x2b, (byte)0x56, (byte)0x2c, (byte)0x56,
       
   222         (byte)0x2d, (byte)0x56, (byte)0x2e, (byte)0x56,
       
   223         (byte)0x2f, (byte)0x56, (byte)0x30, (byte)0x56,
       
   224         (byte)0x31, (byte)0x56, (byte)0x32, (byte)0x56,
       
   225         (byte)0x33, (byte)0x56, (byte)0x34, (byte)0x56,
       
   226         (byte)0x35, (byte)0x56, (byte)0x36, (byte)0x56,
       
   227         (byte)0x37, (byte)0x56, (byte)0x38, (byte)0x56,
       
   228         (byte)0x39, (byte)0x56, (byte)0x3a, (byte)0x56,
       
   229         (byte)0x3b, (byte)0x56, (byte)0x3c, (byte)0x56,
       
   230         (byte)0x3d, (byte)0x56, (byte)0x3e, (byte)0x56,
       
   231         (byte)0x3f, (byte)0x56, (byte)0x40, (byte)0x56,
       
   232         (byte)0x41, (byte)0x56, (byte)0x42, (byte)0x56,
       
   233         (byte)0x43, (byte)0x56, (byte)0x44, (byte)0x56,
       
   234         (byte)0x45, (byte)0x56, (byte)0x46, (byte)0x56,
       
   235         (byte)0x47, (byte)0x56, (byte)0x48, (byte)0x56,
       
   236         (byte)0x49, (byte)0x56, (byte)0x4a, (byte)0x56,
       
   237         (byte)0x4b, (byte)0x56, (byte)0x4c, (byte)0x56,
       
   238         (byte)0x4d, (byte)0x56, (byte)0x4e, (byte)0x56,
       
   239         (byte)0x4f, (byte)0x56, (byte)0x50, (byte)0x56,
       
   240         (byte)0x51, (byte)0x56, (byte)0x52, (byte)0x56,
       
   241         (byte)0x53, (byte)0x56, (byte)0x54, (byte)0x56,
       
   242         (byte)0x55, (byte)0x56, (byte)0x56, (byte)0x56,
       
   243         (byte)0x57, (byte)0x56, (byte)0x58, (byte)0x56,
       
   244         (byte)0x59, (byte)0x56, (byte)0x5a, (byte)0x56,
       
   245         (byte)0x5b, (byte)0x56, (byte)0x5c, (byte)0x56,
       
   246         (byte)0x5d, (byte)0x56, (byte)0x5e, (byte)0x56,
       
   247         (byte)0x5f, (byte)0x56, (byte)0x60, (byte)0x56,
       
   248         (byte)0x61, (byte)0x56, (byte)0x62, (byte)0x56,
       
   249         (byte)0x63, (byte)0x56, (byte)0x64, (byte)0x56,
       
   250         (byte)0x65, (byte)0x56, (byte)0x66, (byte)0x56,
       
   251         (byte)0x67, (byte)0x56, (byte)0x68, (byte)0x56,
       
   252         (byte)0x69, (byte)0x56, (byte)0x6a, (byte)0x56,
       
   253         (byte)0x6b, (byte)0x56, (byte)0x6c, (byte)0x56,
       
   254         (byte)0x6d, (byte)0x56, (byte)0x6e, (byte)0x56,
       
   255         (byte)0x6f, (byte)0x56, (byte)0x70, (byte)0x56,
       
   256         (byte)0x71, (byte)0x56, (byte)0x72, (byte)0x56,
       
   257         (byte)0x73, (byte)0x56, (byte)0x74, (byte)0x56,
       
   258         (byte)0x75, (byte)0x56, (byte)0x76, (byte)0x56,
       
   259         (byte)0x77, (byte)0x56, (byte)0x78, (byte)0x56,
       
   260         (byte)0x79, (byte)0x56, (byte)0x7a, (byte)0x56,
       
   261         (byte)0x7b, (byte)0x56, (byte)0x7c, (byte)0x56,
       
   262         (byte)0x7d, (byte)0x56, (byte)0x7e, (byte)0x57,
       
   263         (byte)0x21, (byte)0x57, (byte)0x22, (byte)0x57,
       
   264         (byte)0x23, (byte)0x57, (byte)0x24, (byte)0x57,
       
   265         (byte)0x25, (byte)0x57, (byte)0x26, (byte)0x57,
       
   266         (byte)0x27, (byte)0x57, (byte)0x28, (byte)0x57,
       
   267         (byte)0x29, (byte)0x57, (byte)0x2a, (byte)0x57,
       
   268         (byte)0x2b, (byte)0x57, (byte)0x2c, (byte)0x57,
       
   269         (byte)0x2d, (byte)0x57, (byte)0x2e, (byte)0x57,
       
   270         (byte)0x2f, (byte)0x57, (byte)0x30, (byte)0x57,
       
   271         (byte)0x31, (byte)0x57, (byte)0x32, (byte)0x57,
       
   272         (byte)0x33, (byte)0x57, (byte)0x34, (byte)0x57,
       
   273         (byte)0x35, (byte)0x57, (byte)0x36, (byte)0x57,
       
   274         (byte)0x37, (byte)0x57, (byte)0x38, (byte)0x57,
       
   275         (byte)0x39, (byte)0x57, (byte)0x3a, (byte)0x57,
       
   276         (byte)0x3b, (byte)0x57, (byte)0x3c, (byte)0x57,
       
   277         (byte)0x3d, (byte)0x57, (byte)0x3e, (byte)0x57,
       
   278         (byte)0x3f, (byte)0x57, (byte)0x40, (byte)0x57,
       
   279         (byte)0x41, (byte)0x57, (byte)0x42, (byte)0x57,
       
   280         (byte)0x43, (byte)0x57, (byte)0x44, (byte)0x57,
       
   281         (byte)0x45, (byte)0x57, (byte)0x46, (byte)0x57,
       
   282         (byte)0x47, (byte)0x57, (byte)0x48, (byte)0x57,
       
   283         (byte)0x49, (byte)0x57, (byte)0x4a, (byte)0x57,
       
   284         (byte)0x4b, (byte)0x57, (byte)0x4c, (byte)0x57,
       
   285         (byte)0x4d, (byte)0x57, (byte)0x4e, (byte)0x57,
       
   286         (byte)0x4f, (byte)0x57, (byte)0x50, (byte)0x57,
       
   287         (byte)0x51, (byte)0x57, (byte)0x52, (byte)0x57,
       
   288         (byte)0x53, (byte)0x57, (byte)0x54, (byte)0x57,
       
   289         (byte)0x55, (byte)0x57, (byte)0x56, (byte)0x57,
       
   290         (byte)0x57, (byte)0x57, (byte)0x58, (byte)0x57,
       
   291         (byte)0x59, (byte)0x57, (byte)0x5a, (byte)0x57,
       
   292         (byte)0x5b, (byte)0x57, (byte)0x5c, (byte)0x57,
       
   293         (byte)0x5d, (byte)0x57, (byte)0x5e, (byte)0x57,
       
   294         (byte)0x5f, (byte)0x57, (byte)0x60, (byte)0x57,
       
   295         (byte)0x61, (byte)0x57, (byte)0x62, (byte)0x57,
       
   296         (byte)0x63, (byte)0x57, (byte)0x64, (byte)0x59,
       
   297         (byte)0x49, (byte)0x59, (byte)0x4a, (byte)0x59,
       
   298         (byte)0x4b, (byte)0x59, (byte)0x4c, (byte)0x59,
       
   299         (byte)0x4d, (byte)0x59, (byte)0x4e, (byte)0x59,
       
   300         (byte)0x4f, (byte)0x59, (byte)0x50, (byte)0x59,
       
   301         (byte)0x51, (byte)0x59, (byte)0x52, (byte)0x59,
       
   302         (byte)0x53, (byte)0x59, (byte)0x54, (byte)0x59,
       
   303         (byte)0x55, (byte)0x59, (byte)0x56, (byte)0x59,
       
   304         (byte)0x57, (byte)0x59, (byte)0x58, (byte)0x59,
       
   305         (byte)0x59, (byte)0x59, (byte)0x5a, (byte)0x59,
       
   306         (byte)0x5b, (byte)0x59, (byte)0x5c, (byte)0x59,
       
   307         (byte)0x5d, (byte)0x59, (byte)0x5e, (byte)0x59,
       
   308         (byte)0x5f, (byte)0x59, (byte)0x60, (byte)0x59,
       
   309         (byte)0x61, (byte)0x59, (byte)0x62, (byte)0x59,
       
   310         (byte)0x63, (byte)0x59, (byte)0x64, (byte)0x59,
       
   311         (byte)0x65, (byte)0x59, (byte)0x66, (byte)0x59,
       
   312         (byte)0x67, (byte)0x59, (byte)0x68, (byte)0x59,
       
   313         (byte)0x69, (byte)0x59, (byte)0x6a, (byte)0x59,
       
   314         (byte)0x6b, (byte)0x59, (byte)0x6c, (byte)0x59,
       
   315         (byte)0x6d, (byte)0x59, (byte)0x6e, (byte)0x59,
       
   316         (byte)0x6f, (byte)0x59, (byte)0x70, (byte)0x59,
       
   317         (byte)0x71, (byte)0x59, (byte)0x72, (byte)0x59,
       
   318         (byte)0x73, (byte)0x59, (byte)0x74, (byte)0x59,
       
   319         (byte)0x75, (byte)0x59, (byte)0x76, (byte)0x59,
       
   320         (byte)0x77, (byte)0x59, (byte)0x78, (byte)0x59,
       
   321         (byte)0x79, (byte)0x59, (byte)0x7a, (byte)0x59,
       
   322         (byte)0x7b, (byte)0x59, (byte)0x7c, (byte)0x59,
       
   323         (byte)0x7d, (byte)0x59, (byte)0x7e, (byte)0x5a,
       
   324         (byte)0x21, (byte)0x5a, (byte)0x22, (byte)0x5a,
       
   325         (byte)0x23, (byte)0x5a, (byte)0x24, (byte)0x5a,
       
   326         (byte)0x25, (byte)0x5a, (byte)0x26, (byte)0x5a,
       
   327         (byte)0x27, (byte)0x5a, (byte)0x28, (byte)0x5a,
       
   328         (byte)0x29, (byte)0x5a, (byte)0x2a, (byte)0x5a,
       
   329         (byte)0x2b, (byte)0x5a, (byte)0x2c, (byte)0x5a,
       
   330         (byte)0x2d, (byte)0x5a, (byte)0x2e, (byte)0x5a,
       
   331         (byte)0x2f, (byte)0x5a, (byte)0x30, (byte)0x5a,
       
   332         (byte)0x31, (byte)0x5a, (byte)0x32, (byte)0x5a,
       
   333         (byte)0x33, (byte)0x5a, (byte)0x34, (byte)0x5a,
       
   334         (byte)0x35, (byte)0x5a, (byte)0x36, (byte)0x5a,
       
   335         (byte)0x37, (byte)0x5a, (byte)0x38, (byte)0x5a,
       
   336         (byte)0x39, (byte)0x5a, (byte)0x3a, (byte)0x5a,
       
   337         (byte)0x3b, (byte)0x5a, (byte)0x3c, (byte)0x5a,
       
   338         (byte)0x3d, (byte)0x5a, (byte)0x3e, (byte)0x5a,
       
   339         (byte)0x3f, (byte)0x5a, (byte)0x40, (byte)0x5a,
       
   340         (byte)0x41, (byte)0x5a, (byte)0x42, (byte)0x5b,
       
   341         (byte)0x35, (byte)0x5b, (byte)0x36, (byte)0x5b,
       
   342         (byte)0x37, (byte)0x5b, (byte)0x38, (byte)0x5b,
       
   343         (byte)0x39, (byte)0x5b, (byte)0x3a, (byte)0x5b,
       
   344         (byte)0x3b, (byte)0x5b, (byte)0x3c, (byte)0x5b,
       
   345         (byte)0x3d, (byte)0x5b, (byte)0x3e, (byte)0x5b,
       
   346         (byte)0x3f, (byte)0x5b, (byte)0x40, (byte)0x5b,
       
   347         (byte)0x41, (byte)0x5b, (byte)0x42, (byte)0x5b,
       
   348         (byte)0x43, (byte)0x5b, (byte)0x44, (byte)0x5b,
       
   349         (byte)0x45, (byte)0x5b, (byte)0x46, (byte)0x5b,
       
   350         (byte)0x47, (byte)0x5b, (byte)0x48, (byte)0x5b,
       
   351         (byte)0x49, (byte)0x5b, (byte)0x4a, (byte)0x5b,
       
   352         (byte)0x4b, (byte)0x5b, (byte)0x4c, (byte)0x5b,
       
   353         (byte)0x4d, (byte)0x5b, (byte)0x4e, (byte)0x5b,
       
   354         (byte)0x4f, (byte)0x5b, (byte)0x50, (byte)0x5b,
       
   355         (byte)0x51, (byte)0x5b, (byte)0x52, (byte)0x5b,
       
   356         (byte)0x53, (byte)0x5b, (byte)0x54, (byte)0x5b,
       
   357         (byte)0x55, (byte)0x5b, (byte)0x56, (byte)0x5b,
       
   358         (byte)0x57, (byte)0x5b, (byte)0x58, (byte)0x5b,
       
   359         (byte)0x59, (byte)0x5b, (byte)0x5a, (byte)0x5b,
       
   360         (byte)0x5b, (byte)0x5b, (byte)0x5c, (byte)0x5b,
       
   361         (byte)0x5d, (byte)0x5b, (byte)0x5e, (byte)0x5b,
       
   362         (byte)0x5f, (byte)0x5b, (byte)0x60, (byte)0x5b,
       
   363         (byte)0x61, (byte)0x5b, (byte)0x62, (byte)0x5b,
       
   364         (byte)0x63, (byte)0x5b, (byte)0x64, (byte)0x5b,
       
   365         (byte)0x65, (byte)0x5b, (byte)0x66, (byte)0x5b,
       
   366         (byte)0x67, (byte)0x5b, (byte)0x68, (byte)0x5b,
       
   367         (byte)0x69, (byte)0x5b, (byte)0x6a, (byte)0x5b,
       
   368         (byte)0x6b, (byte)0x5b, (byte)0x6c, (byte)0x5b,
       
   369         (byte)0x6d, (byte)0x5b, (byte)0x6e, (byte)0x5b,
       
   370         (byte)0x6f, (byte)0x5b, (byte)0x70, (byte)0x5b,
       
   371         (byte)0x71, (byte)0x5b, (byte)0x72, (byte)0x5b,
       
   372         (byte)0x73, (byte)0x5b, (byte)0x74, (byte)0x5b,
       
   373         (byte)0x75, (byte)0x5b, (byte)0x76, (byte)0x5b,
       
   374         (byte)0x77, (byte)0x5b, (byte)0x78, (byte)0x5b,
       
   375         (byte)0x79, (byte)0x5b, (byte)0x7a, (byte)0x5b,
       
   376         (byte)0x7b, (byte)0x5b, (byte)0x7c, (byte)0x5b,
       
   377         (byte)0x7d, (byte)0x5b, (byte)0x7e, (byte)0x5c,
       
   378         (byte)0x21, (byte)0x5c, (byte)0x22, (byte)0x5c,
       
   379         (byte)0x23, (byte)0x5c, (byte)0x24, (byte)0x5c,
       
   380         (byte)0x25, (byte)0x5c, (byte)0x26, (byte)0x5c,
       
   381         (byte)0x27, (byte)0x5c, (byte)0x28, (byte)0x5c,
       
   382         (byte)0x29, (byte)0x5c, (byte)0x2a, (byte)0x5c,
       
   383         (byte)0x2b, (byte)0x5c, (byte)0x2c, (byte)0x5c,
       
   384         (byte)0x2d, (byte)0x5c, (byte)0x2e, (byte)0x5c,
       
   385         (byte)0x2f, (byte)0x5c, (byte)0x30, (byte)0x5c,
       
   386         (byte)0x31, (byte)0x5c, (byte)0x32, (byte)0x5c,
       
   387         (byte)0x33, (byte)0x5c, (byte)0x34, (byte)0x5c,
       
   388         (byte)0x35, (byte)0x5c, (byte)0x36, (byte)0x5d,
       
   389         (byte)0x79, (byte)0x5d, (byte)0x7a, (byte)0x5d,
       
   390         (byte)0x7b, (byte)0x5d, (byte)0x7c, (byte)0x5d,
       
   391         (byte)0x7d, (byte)0x5d, (byte)0x7e, (byte)0x5e,
       
   392         (byte)0x21, (byte)0x5e, (byte)0x22, (byte)0x5e,
       
   393         (byte)0x23, (byte)0x5e, (byte)0x24, (byte)0x5e,
       
   394         (byte)0x25, (byte)0x5e, (byte)0x26, (byte)0x5e,
       
   395         (byte)0x27, (byte)0x5e, (byte)0x28, (byte)0x5e,
       
   396         (byte)0x29, (byte)0x5e, (byte)0x2a, (byte)0x5e,
       
   397         (byte)0x2b, (byte)0x5e, (byte)0x2c, (byte)0x5e,
       
   398         (byte)0x2d, (byte)0x5e, (byte)0x2e, (byte)0x5e,
       
   399         (byte)0x2f, (byte)0x5e, (byte)0x30, (byte)0x5e,
       
   400         (byte)0x31, (byte)0x5e, (byte)0x32, (byte)0x5e,
       
   401         (byte)0x33, (byte)0x5e, (byte)0x34, (byte)0x5e,
       
   402         (byte)0x35, (byte)0x5e, (byte)0x36, (byte)0x5e,
       
   403         (byte)0x37, (byte)0x5e, (byte)0x38, (byte)0x5e,
       
   404         (byte)0x39, (byte)0x5e, (byte)0x3a, (byte)0x5e,
       
   405         (byte)0x3b, (byte)0x5e, (byte)0x3c, (byte)0x5e,
       
   406         (byte)0x3d, (byte)0x5e, (byte)0x3e, (byte)0x5e,
       
   407         (byte)0x3f, (byte)0x5e, (byte)0x40, (byte)0x5e,
       
   408         (byte)0x41, (byte)0x5e, (byte)0x42, (byte)0x5e,
       
   409         (byte)0x43, (byte)0x5e, (byte)0x44, (byte)0x5e,
       
   410         (byte)0x45, (byte)0x5e, (byte)0x46, (byte)0x5e,
       
   411         (byte)0x47, (byte)0x5e, (byte)0x48, (byte)0x5e,
       
   412         (byte)0x49, (byte)0x5e, (byte)0x4a, (byte)0x60,
       
   413         (byte)0x30, (byte)0x60, (byte)0x31, (byte)0x60,
       
   414         (byte)0x32, (byte)0x60, (byte)0x33, (byte)0x60,
       
   415         (byte)0x34, (byte)0x60, (byte)0x35, (byte)0x60,
       
   416         (byte)0x36, (byte)0x60, (byte)0x37, (byte)0x60,
       
   417         (byte)0x38, (byte)0x60, (byte)0x39, (byte)0x60,
       
   418         (byte)0x3a, (byte)0x60, (byte)0x3b, (byte)0x60,
       
   419         (byte)0x3c, (byte)0x60, (byte)0x3d, (byte)0x60,
       
   420         (byte)0x3e, (byte)0x60, (byte)0x3f, (byte)0x73,
       
   421         (byte)0x26, (byte)0x73, (byte)0x27, (byte)0x73,
       
   422         (byte)0x28, (byte)0x73, (byte)0x29, (byte)0x73,
       
   423         (byte)0x2a, (byte)0x73, (byte)0x2b, (byte)0x73,
       
   424         (byte)0x2c, (byte)0x73, (byte)0x2d, (byte)0x73,
       
   425         (byte)0x2e, (byte)0x73, (byte)0x2f, (byte)0x73,
       
   426         (byte)0x30, (byte)0x73, (byte)0x31, (byte)0x73,
       
   427         (byte)0x32, (byte)0x73, (byte)0x33, (byte)0x73,
       
   428         (byte)0x34, (byte)0x73, (byte)0x35, (byte)0x73,
       
   429         (byte)0x36, (byte)0x73, (byte)0x37, (byte)0x73,
       
   430         (byte)0x38, (byte)0x73, (byte)0x39, (byte)0x73,
       
   431         (byte)0x3a, (byte)0x73, (byte)0x3b, (byte)0x73,
       
   432         (byte)0x3c, (byte)0x73, (byte)0x3d, (byte)0x73,
       
   433         (byte)0x3e, (byte)0x73, (byte)0x3f, (byte)0x73,
       
   434         (byte)0x40, (byte)0x73, (byte)0x41, (byte)0x73,
       
   435         (byte)0x42, (byte)0x73, (byte)0x43, (byte)0x73,
       
   436         (byte)0x44, (byte)0x73, (byte)0x45, (byte)0x73,
       
   437         (byte)0x46, (byte)0x73, (byte)0x47, (byte)0x73,
       
   438         (byte)0x48, (byte)0x73, (byte)0x49, (byte)0x73,
       
   439         (byte)0x4a, (byte)0x73, (byte)0x4b, (byte)0x73,
       
   440         (byte)0x4c, (byte)0x73, (byte)0x4d, (byte)0x73,
       
   441         (byte)0x4e, (byte)0x73, (byte)0x4f, (byte)0x73,
       
   442         (byte)0x50, (byte)0x73, (byte)0x51, (byte)0x73,
       
   443         (byte)0x52, (byte)0x73, (byte)0x53, (byte)0x73,
       
   444         (byte)0x54, (byte)0x73, (byte)0x55, (byte)0x73,
       
   445         (byte)0x56, (byte)0x73, (byte)0x57, (byte)0x73,
       
   446         (byte)0x58, (byte)0x73, (byte)0x59, (byte)0x73,
       
   447         (byte)0x5a, (byte)0x73, (byte)0x5b, (byte)0x73,
       
   448         (byte)0x5c, (byte)0x73, (byte)0x5d, (byte)0x73,
       
   449         (byte)0x5e, (byte)0x73, (byte)0x5f, (byte)0x73,
       
   450         (byte)0x60, (byte)0x73, (byte)0x61, (byte)0x73,
       
   451         (byte)0x62, (byte)0x73, (byte)0x63, (byte)0x73,
       
   452         (byte)0x64, (byte)0x73, (byte)0x65, (byte)0x73,
       
   453         (byte)0x66, (byte)0x73, (byte)0x67, (byte)0x73,
       
   454         (byte)0x68, (byte)0x73, (byte)0x69, (byte)0x73,
       
   455         (byte)0x6a, (byte)0x73, (byte)0x6b, (byte)0x73,
       
   456         (byte)0x6c, (byte)0x73, (byte)0x6d, (byte)0x73,
       
   457         (byte)0x6e, (byte)0x73, (byte)0x6f, (byte)0x73,
       
   458         (byte)0x70, (byte)0x73, (byte)0x71, (byte)0x73,
       
   459         (byte)0x72, (byte)0x73, (byte)0x73, (byte)0x73,
       
   460         (byte)0x74, (byte)0x73, (byte)0x75, (byte)0x73,
       
   461         (byte)0x76, (byte)0x73, (byte)0x77, (byte)0x73,
       
   462         (byte)0x78, (byte)0x73, (byte)0x79, (byte)0x73,
       
   463         (byte)0x7a, (byte)0x73, (byte)0x7b, (byte)0x73,
       
   464         (byte)0x7c, (byte)0x73, (byte)0x7d, (byte)0x73,
       
   465         (byte)0x7e, (byte)0x74, (byte)0x21, (byte)0x74,
       
   466         (byte)0x22, (byte)0x74, (byte)0x23, (byte)0x74,
       
   467         (byte)0x24, (byte)0x74, (byte)0x25, (byte)0x74,
       
   468         (byte)0x26
       
   469     };
       
   470 
       
   471     private static byte[] expectedBytes_JISX0201KATAKANA1 =
       
   472     {
       
   473         (byte)0x1b, (byte)0x28, (byte)0x49,
       
   474         (byte)0x21, (byte)0x22, (byte)0x23, (byte)0x24,
       
   475         (byte)0x25, (byte)0x26, (byte)0x27, (byte)0x28,
       
   476         (byte)0x29, (byte)0x2a, (byte)0x2b, (byte)0x2c,
       
   477         (byte)0x2d, (byte)0x2e, (byte)0x2f, (byte)0x30,
       
   478         (byte)0x31, (byte)0x32, (byte)0x33, (byte)0x34,
       
   479         (byte)0x35, (byte)0x36, (byte)0x37, (byte)0x38,
       
   480         (byte)0x39, (byte)0x3a, (byte)0x3b, (byte)0x3c,
       
   481         (byte)0x3d, (byte)0x3e, (byte)0x3f, (byte)0x40,
       
   482         (byte)0x41, (byte)0x42, (byte)0x43, (byte)0x44,
       
   483         (byte)0x45, (byte)0x46, (byte)0x47, (byte)0x48,
       
   484         (byte)0x49, (byte)0x4a, (byte)0x4b, (byte)0x4c,
       
   485         (byte)0x4d, (byte)0x4e, (byte)0x4f, (byte)0x50,
       
   486         (byte)0x51, (byte)0x52, (byte)0x53, (byte)0x54,
       
   487         (byte)0x55, (byte)0x56, (byte)0x57, (byte)0x58,
       
   488         (byte)0x59, (byte)0x5a, (byte)0x5b, (byte)0x5c,
       
   489         (byte)0x5d, (byte)0x5e, (byte)0x5f
       
   490     };
       
   491 
       
   492     private static byte[] expectedBytes_JISX0201KATAKANA2 =
       
   493     {
       
   494         (byte)0x1b, (byte)0x24, (byte)0x42,
       
   495         (byte)0x21, (byte)0x23, (byte)0x21, (byte)0x56,
       
   496         (byte)0x21, (byte)0x57, (byte)0x21, (byte)0x22,
       
   497         (byte)0x21, (byte)0x26, (byte)0x25, (byte)0x72,
       
   498         (byte)0x25, (byte)0x21, (byte)0x25, (byte)0x23,
       
   499         (byte)0x25, (byte)0x25, (byte)0x25, (byte)0x27,
       
   500         (byte)0x25, (byte)0x29, (byte)0x25, (byte)0x63,
       
   501         (byte)0x25, (byte)0x65, (byte)0x25, (byte)0x67,
       
   502         (byte)0x25, (byte)0x43, (byte)0x21, (byte)0x3c,
       
   503         (byte)0x25, (byte)0x22, (byte)0x25, (byte)0x24,
       
   504         (byte)0x25, (byte)0x26, (byte)0x25, (byte)0x28,
       
   505         (byte)0x25, (byte)0x2a, (byte)0x25, (byte)0x2b,
       
   506         (byte)0x25, (byte)0x2d, (byte)0x25, (byte)0x2f,
       
   507         (byte)0x25, (byte)0x31, (byte)0x25, (byte)0x33,
       
   508         (byte)0x25, (byte)0x35, (byte)0x25, (byte)0x37,
       
   509         (byte)0x25, (byte)0x39, (byte)0x25, (byte)0x3b,
       
   510         (byte)0x25, (byte)0x3d, (byte)0x25, (byte)0x3f,
       
   511         (byte)0x25, (byte)0x41, (byte)0x25, (byte)0x44,
       
   512         (byte)0x25, (byte)0x46, (byte)0x25, (byte)0x48,
       
   513         (byte)0x25, (byte)0x4a, (byte)0x25, (byte)0x4b,
       
   514         (byte)0x25, (byte)0x4c, (byte)0x25, (byte)0x4d,
       
   515         (byte)0x25, (byte)0x4e, (byte)0x25, (byte)0x4f,
       
   516         (byte)0x25, (byte)0x52, (byte)0x25, (byte)0x55,
       
   517         (byte)0x25, (byte)0x58, (byte)0x25, (byte)0x5b,
       
   518         (byte)0x25, (byte)0x5e, (byte)0x25, (byte)0x5f,
       
   519         (byte)0x25, (byte)0x60, (byte)0x25, (byte)0x61,
       
   520         (byte)0x25, (byte)0x62, (byte)0x25, (byte)0x64,
       
   521         (byte)0x25, (byte)0x66, (byte)0x25, (byte)0x68,
       
   522         (byte)0x25, (byte)0x69, (byte)0x25, (byte)0x6a,
       
   523         (byte)0x25, (byte)0x6b, (byte)0x25, (byte)0x6c,
       
   524         (byte)0x25, (byte)0x6d, (byte)0x25, (byte)0x6f,
       
   525         (byte)0x25, (byte)0x73, (byte)0x21, (byte)0x2b,
       
   526         (byte)0x21, (byte)0x2c,
       
   527         (byte)0x1b, (byte)0x28, (byte)0x42
       
   528     };
       
   529 
       
   530     private static byte[] expectedBytes_JISX0208NECROW13 =
       
   531     {
       
   532         (byte)0x1b, (byte)0x24, (byte)0x42,
       
   533         (byte)0x2d, (byte)0x21, (byte)0x2d, (byte)0x22,
       
   534         (byte)0x2d, (byte)0x23, (byte)0x2d, (byte)0x24,
       
   535         (byte)0x2d, (byte)0x25, (byte)0x2d, (byte)0x26,
       
   536         (byte)0x2d, (byte)0x27, (byte)0x2d, (byte)0x28,
       
   537         (byte)0x2d, (byte)0x29, (byte)0x2d, (byte)0x2a,
       
   538         (byte)0x2d, (byte)0x2b, (byte)0x2d, (byte)0x2c,
       
   539         (byte)0x2d, (byte)0x2d, (byte)0x2d, (byte)0x2e,
       
   540         (byte)0x2d, (byte)0x2f, (byte)0x2d, (byte)0x30,
       
   541         (byte)0x2d, (byte)0x31, (byte)0x2d, (byte)0x32,
       
   542         (byte)0x2d, (byte)0x33, (byte)0x2d, (byte)0x34,
       
   543         (byte)0x2d, (byte)0x35, (byte)0x2d, (byte)0x36,
       
   544         (byte)0x2d, (byte)0x37, (byte)0x2d, (byte)0x38,
       
   545         (byte)0x2d, (byte)0x39, (byte)0x2d, (byte)0x3a,
       
   546         (byte)0x2d, (byte)0x3b, (byte)0x2d, (byte)0x3c,
       
   547         (byte)0x2d, (byte)0x3d, (byte)0x2d, (byte)0x3e,
       
   548         (byte)0x2d, (byte)0x40, (byte)0x2d, (byte)0x41,
       
   549         (byte)0x2d, (byte)0x42, (byte)0x2d, (byte)0x43,
       
   550         (byte)0x2d, (byte)0x44, (byte)0x2d, (byte)0x45,
       
   551         (byte)0x2d, (byte)0x46, (byte)0x2d, (byte)0x47,
       
   552         (byte)0x2d, (byte)0x48, (byte)0x2d, (byte)0x49,
       
   553         (byte)0x2d, (byte)0x4a, (byte)0x2d, (byte)0x4b,
       
   554         (byte)0x2d, (byte)0x4c, (byte)0x2d, (byte)0x4d,
       
   555         (byte)0x2d, (byte)0x4e, (byte)0x2d, (byte)0x4f,
       
   556         (byte)0x2d, (byte)0x50, (byte)0x2d, (byte)0x51,
       
   557         (byte)0x2d, (byte)0x52, (byte)0x2d, (byte)0x53,
       
   558         (byte)0x2d, (byte)0x54, (byte)0x2d, (byte)0x55,
       
   559         (byte)0x2d, (byte)0x56, (byte)0x2d, (byte)0x5f,
       
   560         (byte)0x2d, (byte)0x60, (byte)0x2d, (byte)0x61,
       
   561         (byte)0x2d, (byte)0x62, (byte)0x2d, (byte)0x63,
       
   562         (byte)0x2d, (byte)0x64, (byte)0x2d, (byte)0x65,
       
   563         (byte)0x2d, (byte)0x66, (byte)0x2d, (byte)0x67,
       
   564         (byte)0x2d, (byte)0x68, (byte)0x2d, (byte)0x69,
       
   565         (byte)0x2d, (byte)0x6a, (byte)0x2d, (byte)0x6b,
       
   566         (byte)0x2d, (byte)0x6c, (byte)0x2d, (byte)0x6d,
       
   567         (byte)0x2d, (byte)0x6e, (byte)0x2d, (byte)0x6f,
       
   568         (byte)0x2d, (byte)0x73, (byte)0x2d, (byte)0x74,
       
   569         (byte)0x2d, (byte)0x78, (byte)0x2d, (byte)0x79,
       
   570         (byte)0x1b, (byte)0x28, (byte)0x42
       
   571     };
       
   572 
       
   573 
       
   574     private static String MIXEDCONTENT =
       
   575         "JA\u3000\u3002\u0062\uFF64PAN" +
       
   576         "\uFF0C\uFF0E\u00A5\uFF65\uFF66X\u203E" +
       
   577         "\u30FB\uFF67\u203E";
       
   578 
       
   579     static byte[] mixedBytesExpected = {
       
   580         (byte)0x4a, (byte)0x41, (byte)0x1b, (byte)0x24,
       
   581         (byte)0x42, (byte)0x21, (byte)0x21, (byte)0x21,
       
   582         (byte)0x23, (byte)0x1b, (byte)0x28, (byte)0x42,
       
   583         (byte)0x62, (byte)0x1b, (byte)0x28, (byte)0x49,
       
   584         (byte)0x24, (byte)0x1b, (byte)0x28, (byte)0x42,
       
   585         (byte)0x50, (byte)0x41, (byte)0x4e, (byte)0x1b,
       
   586         (byte)0x24, (byte)0x42, (byte)0x21, (byte)0x24,
       
   587         (byte)0x21, (byte)0x25, (byte)0x1b, (byte)0x28,
       
   588         (byte)0x4a, (byte)0x5c, (byte)0x1b, (byte)0x28,
       
   589         (byte)0x49, (byte)0x25, (byte)0x26, (byte)0x1b,
       
   590         (byte)0x28, (byte)0x42, (byte)0x58, (byte)0x1b,
       
   591         (byte)0x28, (byte)0x4a, (byte)0x7e, (byte)0x1b,
       
   592         (byte)0x24, (byte)0x42, (byte)0x21, (byte)0x26,
       
   593         (byte)0x1b, (byte)0x28, (byte)0x49, (byte)0x27,
       
   594         (byte)0x1b, (byte)0x28, (byte)0x4a, (byte)0x7e,
       
   595         (byte)0x1b, (byte)0x28, (byte)0x42  };
       
   596 
       
   597     private static byte[] repeatingEscapes = {
       
   598         (byte)0x4a, (byte)0x41, (byte)0x1b, (byte)0x24,
       
   599         (byte)0x42, (byte)0x1b, (byte)0x24, (byte)0x42,
       
   600         (byte)0x21, (byte)0x21, (byte)0x21,
       
   601         (byte)0x23, (byte)0x1b, (byte)0x28, (byte)0x42,
       
   602         // embedded repeated iso-2022 escapes (see bugID 4879522)
       
   603         (byte)0x1b, (byte)0x28, (byte)0x42,
       
   604         (byte)0x62, (byte)0x1b, (byte)0x28, (byte)0x49,
       
   605         (byte)0x0f, (byte)0x0e, (byte)0x0f,
       
   606         (byte)0x1b, (byte)0x28, (byte)0x49,
       
   607         (byte)0x24, (byte)0x1b, (byte)0x28, (byte)0x42,
       
   608         (byte)0x50, (byte)0x41, (byte)0x4e,
       
   609         // embedded shift chars (see bugID 4879522)
       
   610         (byte)0x0e, (byte)0x0f,
       
   611         (byte)0x1b,
       
   612         (byte)0x24, (byte)0x42, (byte)0x21, (byte)0x24,
       
   613         (byte)0x21, (byte)0x25, (byte)0x1b, (byte)0x28,
       
   614         (byte)0x4a, (byte)0x5c, (byte)0x1b, (byte)0x28,
       
   615         (byte)0x49, (byte)0x25, (byte)0x26, (byte)0x1b,
       
   616         (byte)0x28, (byte)0x42, (byte)0x58, (byte)0x1b,
       
   617         (byte)0x28, (byte)0x4a, (byte)0x7e, (byte)0x1b,
       
   618         (byte)0x24, (byte)0x42, (byte)0x21, (byte)0x26,
       
   619         (byte)0x1b, (byte)0x28, (byte)0x49, (byte)0x27,
       
   620         (byte)0x1b, (byte)0x28, (byte)0x4a, (byte)0x7e,
       
   621         (byte)0x1b, (byte)0x28, (byte)0x42  };
       
   622 
       
   623     private static String JISX0212 =
       
   624         "\u02d8\u6896\ue757";
       
   625 
       
   626     private static byte[] expectedBytes_JISX0212 = {
       
   627         (byte)0x1b, (byte)0x24, (byte)0x28, (byte)0x44,
       
   628         (byte)0x22, (byte)0x2f, (byte)0x43, (byte)0x6f,
       
   629         (byte)0x7e, (byte)0x7e,
       
   630         (byte)0x1b, (byte)0x28, (byte)0x42
       
   631     };
       
   632 
       
   633     /*
       
   634      * Tests the roundtrip integrity and expected encoding
       
   635      * correctness for a String containing a substantial
       
   636      * subset of MS5022X encodeable chars
       
   637      */
       
   638 
       
   639     private static void roundTrip(String name,
       
   640                                   String testStr,
       
   641                                   byte[] expectBytes)
       
   642     throws Exception {
       
   643         byte[] encodedBytes = testStr.getBytes(name);
       
   644         if (encodedBytes.length != expectBytes.length) {
       
   645             //System.out.printf("l1=%d, l2=%d\n",
       
   646             //                  encodedBytes.length,expectBytes.length);
       
   647             throw new Exception(name + " Encoder error");
       
   648         }
       
   649         for (int i = 0; i < expectBytes.length; i++) {
       
   650 
       
   651             if (encodedBytes[i] != expectBytes[i])  {
       
   652                 //System.out.printf("--->");
       
   653                 //throw new Exception(name + " Encoder error");
       
   654             }
       
   655             //System.out.printf("%x, %x\n",
       
   656             //encodedBytes[i],expectBytes[i]);
       
   657         }
       
   658         String decoded = new String(encodedBytes, name);
       
   659         if (!decoded.equals(testStr)) {
       
   660             throw new Exception(name + " Decoder error");
       
   661         }
       
   662         String decoded2 = new String(repeatingEscapes, name);
       
   663         if (!decoded2.equals(MIXEDCONTENT)) {
       
   664             throw new Exception(name + " Decoder error");
       
   665         }
       
   666      }
       
   667 
       
   668     public static void main(String[] args) throws Exception {
       
   669         String map = System.getProperty("sun.nio.cs.map");
       
   670         if (map != null) {
       
   671             map = map.toLowerCase(java.util.Locale.US);
       
   672             Charset cs = Charset.forName("ISO-2022-JP");
       
   673             if (map.indexOf("x-windows-50221/ISO-2022-jp") != -1 &&
       
   674                 !"x-windows-50220".equals(cs.name()) ||
       
   675                 map.indexOf("x-windows-50220/ISO-2022-jp") != -1 &&
       
   676                 !"x-windows-50220".equals(cs.name()) ||
       
   677                 map.indexOf("x-windows-iso2022jp/ISO-2022-jp") != -1 &&
       
   678                 !"x-windows-iso2022jp".equals(cs.name())) {
       
   679                 throw new Exception("Error: sun.nio.cs.map=" + map +
       
   680                                     ", ISO-2022-JP=" + cs.name());
       
   681             } else {
       
   682                 System.out.printf("ISO-2022-JP=%s\n", cs.name());
       
   683             }
       
   684         }
       
   685 
       
   686         String testStr = US_ASCII +
       
   687                          JISX0208SUBSET +
       
   688                          JISX0201KATAKANA +
       
   689                          JISX0208NECROW13;
       
   690 
       
   691         byte[] expectedBytes= (new String(expectedBytes_US_ASCII, "ASCII") +
       
   692                                new String(expectedBytes_JISX0208SUBSET, "ASCII") +
       
   693                                new String(expectedBytes_JISX0201KATAKANA1, "ASCII") +
       
   694                                new String(expectedBytes_JISX0208NECROW13, "ASCII")).
       
   695           getBytes("ASCII");
       
   696 
       
   697         //MS50221
       
   698         roundTrip("MS50221", testStr, expectedBytes);
       
   699         roundTrip("MS50221", JISX0212, expectedBytes_JISX0212);
       
   700 
       
   701         //MS50220 without halfwidth kana
       
   702         roundTrip("MS50220",
       
   703                   US_ASCII + JISX0208SUBSET + JISX0208NECROW13,
       
   704                   (new String(expectedBytes_US_ASCII, "ASCII") +
       
   705                    new String(expectedBytes_JISX0208SUBSET, "ASCII") +
       
   706                    new String(expectedBytes_JISX0208NECROW13,
       
   707                               3,
       
   708                               expectedBytes_JISX0208NECROW13.length - 3,
       
   709                               "ASCII")).getBytes("ASCII"));
       
   710         roundTrip("MS50220", JISX0212, expectedBytes_JISX0212);
       
   711 
       
   712         // Try MS50220 with halfwidth kana encoding
       
   713         byte[] encodedBytes = JISX0201KATAKANA.getBytes("MS50220");
       
   714         if (encodedBytes.length != expectedBytes_JISX0201KATAKANA2.length) {
       
   715             throw new Exception("MS50220 Encoder error");
       
   716         }
       
   717         for (int i = 0; i < expectedBytes_JISX0201KATAKANA2.length; i++) {
       
   718             if (encodedBytes[i] != expectedBytes_JISX0201KATAKANA2[i])  {
       
   719                 throw new Exception("MS50220 Encoder error");
       
   720             }
       
   721         }
       
   722 
       
   723         //x-windows-iso2022jp
       
   724         testStr = testStr.replace('\u301E', '\u301D')
       
   725                          .replace('\u301C', '\uFF4E')
       
   726                          .replace('\u2016', '\u2225');
       
   727         roundTrip("x-windows-iso2022jp",
       
   728                   testStr,
       
   729                   expectedBytes);
       
   730 
       
   731         testStr = MIXEDCONTENT;
       
   732         roundTrip("MS50221", testStr , mixedBytesExpected);
       
   733 
       
   734         // Test for bugID 4913711
       
   735         // ISO-2022-JP encoding of a single input char yields
       
   736         // 8 output bytes. Prior to fix for 4913711 the
       
   737         // max bytes per char value was underspecified as 5.0
       
   738         // and the code below would have thrown a BufferOverflow
       
   739         // exception. This test validates the fix for 4913711
       
   740 
       
   741         testStr = "\u3042";
       
   742         byte[] expected = { (byte)0x1b, (byte)0x24, (byte)0x42,
       
   743                             (byte)0x24, (byte)0x22, (byte)0x1b,
       
   744                             (byte)0x28, (byte)0x42 };
       
   745         byte[] encoded = testStr.getBytes("MS50221");
       
   746         for (int i = 0; i < expected.length; i++) {
       
   747             if (encoded[i] != expected[i])
       
   748                throw new Exception("MS50221 Decoder error");
       
   749         }
       
   750     }
       
   751 }