6675856: Open charset tests

Moved non-confidiential test cased from closed repo to open repo

Reviewed-by: martin
This commit is contained in:
Xueming Shen 2008-06-30 14:06:34 -07:00
parent 35038e62cd
commit dd2dfec9f5
67 changed files with 40607 additions and 0 deletions

View File

@ -0,0 +1,64 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4834154
@summary Decode a file using EUC-TW, test for decode errors
*/
/*
* Tests for decode errors in NIO EUC-TW decoder. 4734607 details
* decoding errors which occur when the input file > 8k in size
* and contains numerous US-ASCII range chars
*/
import java.io.*;
public class BufferUnderflowEUCTWTest {
private static int BUFFERSIZE = 8194;
public static void main (String[] args) throws Exception {
int i = 0;
byte[] b = new byte[BUFFERSIZE];
for (; i < BUFFERSIZE - 4; i++) // pad with zeroes
b[i] = 0;
// Overspill a valid EUC-TW 4 byte sequence between 2
// successive input buffers.
b[i++] = (byte)0x8E;
b[i++] = (byte)0xA2;
b[i++] = (byte)0xA1;
b[i++] = (byte)0xA6;
ByteArrayInputStream r = new ByteArrayInputStream(b);
try {
InputStreamReader isr=new InputStreamReader(r, "EUC-TW");
char[] cc = new char[BUFFERSIZE];
int cx = isr.read(cc);
} catch (ArrayIndexOutOfBoundsException e) {
throw new Exception("Array Index error: bug 4834154");
}
}
}

View File

@ -0,0 +1,99 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
* @bug 4216191 4721369 4807283
@summary Test to validate case insensitivity of encoding alias names
*/
// Fixed since 1.4.0 by virtue of NIO charset lookup mechanism
// which is by design case insensitive
import java.lang.*;
import java.io.*;
public class CheckCaseInsensitiveEncAliases
{
public static void main(String args[]) throws Exception
{
// Try various encoding names in mixed cases
// Tests subset of encoding names provided within bugID 4216191
// Various forms of US-ASCII
tryToEncode( "ANSI_X3.4-1968" );
tryToEncode( "iso-ir-6" );
tryToEncode( "ANSI_X3.4-1986" );
tryToEncode( "ISO_646.irv:1991" );
tryToEncode( "ASCII" );
tryToEncode( "ascii" );
tryToEncode( "Ascii" );
tryToEncode( "Ascii7" );
tryToEncode( "ascii7" );
tryToEncode( "ISO646-US" );
tryToEncode( "US-ASCII" );
tryToEncode( "us-ascii" );
tryToEncode( "US-Ascii" );
tryToEncode( "us" );
tryToEncode( "IBM367" );
tryToEncode( "cp367" );
tryToEncode( "csASCII" );
// Variants on Unicode
tryToEncode( "Unicode" );
tryToEncode( "UNICODE" );
tryToEncode( "unicode" );
// Variants on Big5
tryToEncode( "Big5" );
tryToEncode( "big5" );
tryToEncode( "bIg5" );
tryToEncode( "biG5" );
tryToEncode( "bIG5" );
// Variants of Cp1252
tryToEncode( "Cp1252" );
tryToEncode( "cp1252" );
tryToEncode( "CP1252" );
// Variants of PCK
tryToEncode( "pck" );
tryToEncode( "Pck" );
}
public static final String ENCODE_STRING = "Encode me";
public static void tryToEncode( String encoding) throws Exception
{
try
{
byte[] bytes = ENCODE_STRING.getBytes( encoding );
System.out.println( "Encoding \"" + encoding + "\" recognized" );
}
catch( UnsupportedEncodingException e )
{
throw new Exception("Encoding \"" + encoding + "\" NOT recognized");
}
}
}

View File

@ -0,0 +1,313 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4513767 4961027
@summary Checks canonical names match between old and (NIO) core charsets
*/
import java.io.InputStreamReader;
import java.io.IOException;
public class CheckHistoricalNames {
static int failed = 0;
public static void main (String[] args) throws Exception {
checkHistoricalName("ASCII");
checkHistoricalName("Cp1252");
checkHistoricalName("ISO8859_1");
checkHistoricalName("UnicodeBigUnmarked");
checkHistoricalName("UnicodeLittle");
checkHistoricalName("UnicodeLittleUnmarked");
checkHistoricalName("UTF8");
checkHistoricalName("UTF-16");
checkMappedName("UnicodeBig", "UTF-16");
checkMappedName("US-ASCII", "ASCII");
checkMappedName("ISO-8859-1", "ISO8859_1");
checkMappedName("UTF-8", "UTF8");
checkMappedName("UTF-16BE", "UnicodeBigUnmarked");
checkMappedName("UTF-16LE", "UnicodeLittleUnmarked");
checkHistoricalName("ISO8859_2");
checkHistoricalName("ISO8859_4");
checkHistoricalName("ISO8859_5");
checkHistoricalName("ISO8859_7");
checkHistoricalName("ISO8859_9");
checkHistoricalName("ISO8859_13");
checkHistoricalName("KOI8_R");
checkHistoricalName("Cp1250");
checkHistoricalName("Cp1251");
checkHistoricalName("Cp1253");
checkHistoricalName("Cp1254");
checkHistoricalName("Cp1257");
checkMappedName("ISO-8859-2", "ISO8859_2");
checkMappedName("ISO-8859-4", "ISO8859_4");
checkMappedName("ISO-8859-5", "ISO8859_5");
checkMappedName("ISO-8859-7", "ISO8859_7");
checkMappedName("ISO-8859-9", "ISO8859_9");
checkMappedName("ISO-8859-13", "ISO8859_13");
checkMappedName("KOI8-R", "KOI8_R");
checkMappedName("windows-1250", "Cp1250");
checkMappedName("windows-1251","Cp1251");
checkMappedName("windows-1253", "Cp1253");
checkMappedName("windows-1254", "Cp1254");
checkMappedName("windows-1257", "Cp1257");
checkHistoricalName("EUC_CN");
checkHistoricalName("EUC_JP");
checkHistoricalName("EUC_JP_LINUX");
checkHistoricalName("EUC_KR");
checkHistoricalName("EUC_TW");
checkHistoricalName("ISO2022CN");
checkHistoricalName("ISO2022JP");
checkHistoricalName("ISO2022KR");
checkHistoricalName("ISO8859_3");
checkHistoricalName("ISO8859_6");
checkHistoricalName("ISO8859_8");
checkHistoricalName("Cp1255");
checkHistoricalName("Cp1256");
checkHistoricalName("Cp1258");
checkHistoricalName("MS936");
checkHistoricalName("MS949");
checkHistoricalName("MS950");
checkHistoricalName("TIS620");
checkMappedName("EUC-CN", "EUC_CN");
checkMappedName("EUC-JP", "EUC_JP");
checkMappedName("EUC-JP-LINUX", "EUC_JP_LINUX");
checkMappedName("EUC-TW", "EUC_TW");
checkMappedName("EUC-KR", "EUC_KR");
checkMappedName("ISO-2022-CN", "ISO2022CN");
checkMappedName("ISO-2022-JP", "ISO2022JP");
checkMappedName("ISO-2022-KR", "ISO2022KR");
checkMappedName("ISO-8859-3", "ISO8859_3");
checkMappedName("ISO-8859-6", "ISO8859_6");
checkMappedName("ISO-8859-8", "ISO8859_8");
checkMappedName("windows-1255", "Cp1255");
checkMappedName("windows-1256", "Cp1256");
checkMappedName("windows-1258", "Cp1258");
checkMappedName("windows-936", "GBK");
checkMappedName("windows-949", "MS949");
checkMappedName("windows-950", "MS950");
checkMappedName("x-MS950-HKSCS", "MS950_HKSCS");
checkMappedName("x-PCK", "PCK");
checkMappedName("Shift_JIS", "SJIS");
checkMappedName("x-JISAutoDetect", "JISAutoDetect");
checkMappedName("TIS-620", "TIS620");
checkMappedName("x-Big5-Solaris", "Big5_Solaris");
checkHistoricalName("Cp037");
checkHistoricalName("Cp1006");
checkHistoricalName("Cp1025");
checkHistoricalName("Cp1026");
checkHistoricalName("Cp1046");
checkHistoricalName("Cp1047");
checkHistoricalName("Cp1097");
checkHistoricalName("Cp1098");
checkHistoricalName("Cp1112");
checkHistoricalName("Cp1122");
checkHistoricalName("Cp1123");
checkHistoricalName("Cp1124");
checkHistoricalName("Cp1140");
checkHistoricalName("Cp1141");
checkHistoricalName("Cp1142");
checkHistoricalName("Cp1143");
checkHistoricalName("Cp1144");
checkHistoricalName("Cp1145");
checkHistoricalName("Cp1146");
checkHistoricalName("Cp1147");
checkHistoricalName("Cp1148");
checkHistoricalName("Cp1149");
checkHistoricalName("Cp1381");
checkHistoricalName("Cp1383");
checkHistoricalName("Cp273");
checkHistoricalName("Cp277");
checkHistoricalName("Cp278");
checkHistoricalName("Cp280");
checkHistoricalName("Cp284");
checkHistoricalName("Cp285");
checkHistoricalName("Cp297");
checkHistoricalName("Cp33722");
checkHistoricalName("Cp420");
checkHistoricalName("Cp424");
checkHistoricalName("Cp437");
checkHistoricalName("Cp500");
checkHistoricalName("Cp737");
checkHistoricalName("Cp775");
checkHistoricalName("Cp838");
checkHistoricalName("Cp850");
checkHistoricalName("Cp852");
checkHistoricalName("Cp855");
checkHistoricalName("Cp856");
checkHistoricalName("Cp857");
checkHistoricalName("Cp858");
checkHistoricalName("Cp860");
checkHistoricalName("Cp861");
checkHistoricalName("Cp862");
checkHistoricalName("Cp863");
checkHistoricalName("Cp864");
checkHistoricalName("Cp865");
checkHistoricalName("Cp866");
checkHistoricalName("Cp868");
checkHistoricalName("Cp869");
checkHistoricalName("Cp870");
checkHistoricalName("Cp871");
checkHistoricalName("Cp874");
checkHistoricalName("Cp875");
checkHistoricalName("Cp918");
checkHistoricalName("Cp921");
checkHistoricalName("Cp922");
checkHistoricalName("Cp933");
checkHistoricalName("Cp939");
checkHistoricalName("Cp949");
checkHistoricalName("Cp964");
checkHistoricalName("Cp970");
checkMappedName("IBM037", "Cp037");
checkMappedName("IBM1006", "Cp1006");
checkMappedName("IBM1025", "Cp1025");
checkMappedName("IBM1026", "Cp1026");
checkMappedName("x-IBM1046", "Cp1046");
checkMappedName("IBM1047", "Cp1047");
checkMappedName("IBM1097", "Cp1097");
checkMappedName("IBM1098", "Cp1098");
checkMappedName("IBM1112", "Cp1112");
checkMappedName("IBM1122", "Cp1122");
checkMappedName("IBM1123", "Cp1123");
checkMappedName("IBM1124", "Cp1124");
checkMappedName("IBM01140", "Cp1140");
checkMappedName("IBM01141", "Cp1141");
checkMappedName("IBM01142", "Cp1142");
checkMappedName("IBM01143", "Cp1143");
checkMappedName("IBM01144", "Cp1144");
checkMappedName("IBM01145", "Cp1145");
checkMappedName("IBM01146", "Cp1146");
checkMappedName("IBM01147", "Cp1147");
checkMappedName("IBM01148", "Cp1148");
checkMappedName("IBM01149", "Cp1149");
checkMappedName("IBM1381", "Cp1381");
checkMappedName("IBM1383", "Cp1383");
checkMappedName("IBM273", "Cp273");
checkMappedName("IBM277", "Cp277");
checkMappedName("IBM278", "Cp278");
checkMappedName("IBM280", "Cp280");
checkMappedName("IBM284", "Cp284");
checkMappedName("IBM285", "Cp285");
checkMappedName("IBM297", "Cp297");
checkMappedName("IBM33722", "Cp33722");
checkMappedName("IBM420", "Cp420");
checkMappedName("IBM424", "Cp424");
checkMappedName("IBM437", "Cp437");
checkMappedName("IBM500", "Cp500");
checkMappedName("IBM737", "Cp737");
checkMappedName("IBM775", "Cp775");
checkMappedName("IBM838", "Cp838");
checkMappedName("IBM850", "Cp850");
checkMappedName("IBM852", "Cp852");
checkMappedName("IBM855", "Cp855");
checkMappedName("IBM856", "Cp856");
checkMappedName("IBM857", "Cp857");
checkMappedName("IBM00858", "Cp858");
checkMappedName("IBM860", "Cp860");
checkMappedName("IBM861", "Cp861");
checkMappedName("IBM862", "Cp862");
checkMappedName("IBM863", "Cp863");
checkMappedName("IBM864", "Cp864");
checkMappedName("IBM865", "Cp865");
checkMappedName("IBM866", "Cp866");
checkMappedName("IBM868", "Cp868");
checkMappedName("IBM869", "Cp869");
checkMappedName("IBM870", "Cp870");
checkMappedName("IBM871", "Cp871");
checkMappedName("IBM874", "Cp874");
checkMappedName("IBM875", "Cp875");
checkMappedName("IBM918", "Cp918");
checkMappedName("IBM921", "Cp921");
checkMappedName("IBM922", "Cp922");
checkMappedName("x-IBM930", "Cp930");
checkMappedName("IBM933", "Cp933");
checkMappedName("x-IBM935", "Cp935");
checkMappedName("x-IBM937", "Cp937");
checkMappedName("IBM939", "Cp939");
checkMappedName("x-IBM942", "Cp942");
checkMappedName("x-IBM942C", "Cp942C");
checkMappedName("x-IBM943", "Cp943");
checkMappedName("x-IBM943C", "Cp943C");
checkMappedName("x-IBM948", "Cp948");
checkMappedName("IBM949", "Cp949");
checkMappedName("x-IBM949C", "Cp949C");
checkMappedName("x-IBM950", "Cp950");
checkMappedName("IBM964", "Cp964");
checkMappedName("IBM970", "Cp970");
checkHistoricalName("MacArabic");
checkHistoricalName("MacCentralEurope");
checkHistoricalName("MacCroatian");
checkHistoricalName("MacCyrillic");
checkHistoricalName("MacDingbat");
checkHistoricalName("MacGreek");
checkHistoricalName("MacHebrew");
checkHistoricalName("MacIceland");
checkHistoricalName("MacRoman");
checkHistoricalName("MacRomania");
checkHistoricalName("MacSymbol");
checkHistoricalName("MacThai");
checkHistoricalName("MacTurkish");
checkHistoricalName("MacUkraine");
checkMappedName("x-MacArabic", "MacArabic");
checkMappedName("x-MacCentralEurope", "MacCentralEurope");
checkMappedName("x-MacCroatian", "MacCroatian");
checkMappedName("x-MacCyrillic", "MacCyrillic");
checkMappedName("x-MacDingbat", "MacDingbat");
checkMappedName("x-MacGreek", "MacGreek");
checkMappedName("x-MacHebrew", "MacHebrew");
checkMappedName("x-MacIceland", "MacIceland");
checkMappedName("x-MacRoman", "MacRoman");
checkMappedName("x-MacRomania", "MacRomania");
checkMappedName("x-MacSymbol", "MacSymbol");
checkMappedName("x-MacThai", "MacThai");
checkMappedName("x-MacTurkish", "MacTurkish");
checkMappedName("x-MacUkraine", "MacUkraine");
if (failed != 0)
throw new Exception("Test Failed: " + failed);
else
System.out.println("Test Passed!");
}
private static void checkHistoricalName(String name) throws Exception {
checkMappedName(name, name);
}
private static void checkMappedName(String alias, String canonical)
throws Exception {
InputStreamReader reader = new InputStreamReader(System.in, alias);
if (!reader.getEncoding().equals(canonical)) {
System.out.println("Failed canonical names : mismatch for " + alias
+ " - expected " + canonical
+ ", got " + reader.getEncoding());
failed++;
}
}
}

View File

@ -0,0 +1,65 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4094987
@summary Verify that malformed expression exceptions are thrown
but no internal errors in certain pathologial cases.
*/
import java.io.*;
import java.nio.charset.*;
public class ConvertSingle {
public static void main(String args[]) throws Exception {
// This conversion is pathologically bad - it is attempting to
// read unicode from an ascii encoded string.
// The orignal bug: A internal error in ISR results if the
// byte counter in ByteToCharUnicode
// is not advanced as the input is consumed.
try{
String s = "\n";
byte ss[] = null;
String sstring = "x";
ss = s.getBytes();
ByteArrayInputStream BAIS = new ByteArrayInputStream(ss);
InputStreamReader ISR = new InputStreamReader(BAIS, "Unicode");
BufferedReader BR = new BufferedReader(ISR);
sstring = BR.readLine();
BR.close();
System.out.println(sstring);
} catch (MalformedInputException e){
// Right error
return;
} catch (java.lang.InternalError e) {
throw new Exception("ByteToCharUnicode is failing incorrectly for "
+ " single byte input");
}
}
}

View File

@ -0,0 +1,67 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/**/
public class Decode {
private static boolean isAscii(char c) {
return c < '\u0080';
}
private static boolean isPrintable(char c) {
return ('\u0020' < c) && (c < '\u007f');
}
public static void main(String[] args) throws Throwable {
if (args.length < 2)
throw new Exception("Usage: java Decode CHARSET BYTE [BYTE ...]");
String cs = args[0];
byte[] bytes = new byte[args.length-1];
for (int i = 1; i < args.length; i++) {
String arg = args[i];
bytes[i-1] =
(arg.length() == 1 && isAscii(arg.charAt(0))) ?
(byte) arg.charAt(0) :
arg.equals("ESC") ? 0x1b :
arg.equals("SO") ? 0x0e :
arg.equals("SI") ? 0x0f :
arg.equals("SS2") ? (byte) 0x8e :
arg.equals("SS3") ? (byte) 0x8f :
arg.matches("0x.*") ? Integer.decode(arg).byteValue() :
Integer.decode("0x"+arg).byteValue();
}
String s = new String(bytes, cs);
for (int j = 0; j < s.length(); j++) {
if (j > 0)
System.out.print(' ');
char c = s.charAt(j);
if (isPrintable(c))
System.out.print(c);
else if (c == '\u001b') System.out.print("ESC");
else
System.out.printf("\\u%04x", (int) c);
}
System.out.print("\n");
}
}

View File

@ -0,0 +1,65 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 5101128
@summary Check behavior of CharsetDecoder.decode when overflow occurs
@author Martin Buchholz
*/
import java.util.*;
import java.nio.*;
import java.nio.charset.*;
public class DecoderOverflow {
static int failures = 0;
public static void main(String[] args) throws Exception {
for (String csn : Charset.availableCharsets().keySet()) {
try {
test(csn);
} catch (Throwable t) {
System.out.println(csn);
t.printStackTrace();
failures++;
}
}
if (failures > 0)
throw new Exception(failures + " charsets failed");
}
static void test(String encoding) throws Exception {
String text = "Vote for Duke!";
Charset cs = Charset.forName(encoding);
if (! cs.canEncode() || ! cs.newEncoder().canEncode('.')) return;
ByteBuffer in = ByteBuffer.wrap(text.getBytes(encoding));
CharBuffer out = CharBuffer.allocate(text.length()/2);
CoderResult result = cs.newDecoder().decode(in, out, true);
if (out.hasRemaining() || ! result.isOverflow())
throw new Exception
("out.hasRemaining()=" + out.hasRemaining() +
" result.isOverflow()=" + result.isOverflow() +
" in.capacity()=" + in.capacity() +
" encoding=" + encoding);
}
}

View File

@ -0,0 +1,104 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4867457
@summary Check for correct byte buffer underflow handling in EUC-JP
*/
import java.io.*;
import java.nio.*;
import java.nio.charset.*;
public class EUCJPUnderflowDecodeTest {
public static void main(String[] args) throws Exception{
ByteBuffer bb = ByteBuffer.allocateDirect(255);
CharBuffer cc = CharBuffer.allocate(255);
// Test both regular EUC-JP and Linux variant
String[] charsetNames = { "EUC_JP", "EUC-JP-LINUX" };
for (int i = 0 ; i < charsetNames.length; i++) {
Charset cs = Charset.forName(charsetNames[i]);
CharsetDecoder decoder = cs.newDecoder();
bb.clear();
cc.clear();
// Fakes a partial 3 byte EUC_JP (JIS-X-0212 range)
// encoded character/byte sequence
bb.put((byte)0x8f);
bb.put((byte)0xa2);
bb.flip();
// Now decode with endOfInput method param set to
// indicate to decoder that there is more encoded
// data to follow in a subsequent invocation
CoderResult result = decoder.decode(bb, cc, false);
// java.nio.charset.CharsetDecoder spec specifies
// that the coder ought to return CoderResult.UNDERFLOW
// when insufficient bytes have been supplied to complete
// the decoding operation
if (result != CoderResult.UNDERFLOW) {
throw new Exception("test failed - UNDERFLOW not returned");
}
// Repeat the test with the lead byte (minus its pursuing
// trail byte) for the EUC-JP 2 byte (JIS208) range
decoder.reset();
bb.clear();
cc.clear();
bb.put((byte)0xa1);
bb.flip();
result = decoder.decode(bb, cc, false);
if (result != CoderResult.UNDERFLOW) {
throw new Exception("test failed");
}
// finally ensure that a valid JIS208 range EUC-JP
// 2 byte value is correctly decoded when it is presented
// at the trailing bounds of a ByteBuffer in the case where
// charset decoder expects (endOfInput ==false) more
//input to follow
decoder.reset();
bb.clear();
cc.clear();
bb.put((byte)0xa1);
bb.put((byte)0xc0);
bb.flip();
result = decoder.decode(bb, cc, false);
cc.flip();
if (result != CoderResult.UNDERFLOW && cc.get() != '\uFF3c') {
throw new Exception("test failed to decode EUC-JP (0xA1C0)");
}
}
}
}

View File

@ -0,0 +1,79 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6350021
* @summary Consistency checks when input buffer contains JISX0212 characters
* @author Martin Buchholz
*/
import java.io.*;
import java.util.*;
import java.nio.*;
import java.nio.charset.*;
public class EucJpLinux0212 {
private static void equal(CharBuffer b1, CharBuffer b2) {
equal(b1.position(), b2.position());
equal(b1.limit(), b2.limit());
System.out.printf("positions=%d %d%n", b1.position(), b2.position());
System.out.printf("limits=%d %d%n", b1.limit(), b2.limit());
for (int i = b1.position(); i < b1.limit(); i++)
equal((int)b1.get(i), (int)b2.get(i));
}
private static void realMain(String[] args) throws Throwable {
List<ByteBuffer> bbs = Arrays.asList(
ByteBuffer.allocate(10),
ByteBuffer.allocateDirect(10));
List<CharBuffer> cbs = new ArrayList<CharBuffer>();
for (ByteBuffer bb : bbs) {
bb.put(new byte[]{ (byte)0x8f, 0x01, 0x02,
(byte)0xa1, (byte)0xc0,
0x02, 0x03});
bb.flip();
CharsetDecoder decoder = Charset.forName("EUC_JP_LINUX").newDecoder();
decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
CharBuffer cb = decoder.decode(bb);
cbs.add(cb);
}
equal(cbs.get(0), cbs.get(1));
}
//--------------------- Infrastructure ---------------------------
static volatile int passed = 0, failed = 0;
static void pass() {passed++;}
static void fail() {failed++; Thread.dumpStack();}
static void fail(String msg) {System.out.println(msg); fail();}
static void unexpected(Throwable t) {failed++; t.printStackTrace();}
static void check(boolean cond) {if (cond) pass(); else fail();}
static void equal(Object x, Object y) {
if (x == null ? y == null : x.equals(y)) pass();
else fail(x + " not equal to " + y);}
public static void main(String[] args) throws Throwable {
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
}

View File

@ -0,0 +1,70 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 5016049
@summary ensure euc-jp-linux charset decoder recovery for unmappable input
*/
import java.io.*;
public class EucJpLinuxDecoderRecoveryTest {
public static void main(String[] args) throws Exception {
byte[] encoded = {
// EUC_JP_LINUX mappable JIS X 0208 range
(byte)0xa6, (byte)0xc5,
// EUC_JP_LINUX Unmappable (JIS X 0212 range)
(byte)0x8f, (byte)0xa2, (byte)0xb7,
// EUC_JP_LINUX mappable JIS X 0208 range
(byte)0xa6, (byte)0xc7 };
char[] decodedChars = new char[3];
char[] expectedChars =
{
'\u03B5', // mapped
'\ufffd', // unmapped
'\u03B7' // mapped
};
ByteArrayInputStream bais = new ByteArrayInputStream(encoded);
InputStreamReader isr = new InputStreamReader(bais, "EUC_JP_LINUX");
int n = 0; // number of chars decoded
try {
n = isr.read(decodedChars);
} catch (Exception ex) {
throw new Error("euc-jp-linux decoding broken");
}
// check number of decoded chars is what is expected
if (n != expectedChars.length)
throw new Error("Unexpected number of chars decoded");
// Compare actual decoded with expected
for (int i = 0; i < n; i++) {
if (expectedChars[i] != decodedChars[i])
throw new Error("euc-jp-linux decoding incorrect");
}
}
}

View File

@ -0,0 +1,158 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/**
* @test
* @bug 4114080
* @summary Make sure the euro converters, which are derived from
* existing converters, only differ from their parents at the expected
* code point.
*/
import java.text.*;
import java.util.*;
import java.io.*;
/* Author: Alan Liu
* 7/14/98
*/
public class EuroConverter {
public static void main(String args[]) throws Exception {
boolean pass = true;
char[] map = new char[256]; // map for the encoding
byte[] bytes = new byte[1]; // scratch
char[] chars = new char[1]; // scratch
for (int i=0; i<DATA.length; ) {
String euroEnc = DATA[i++];
String parentEnc = DATA[i++];
System.out.println("Checking encoder " + euroEnc + " against " + parentEnc);
String currentEnc = parentEnc;
try {
// Fill map with parent values
for (int j=-128; j<128; ++j) {
bytes[0] = (byte)j;
char parentValue = new String(bytes, parentEnc).charAt(0);
// NOTE: 0x25 doesn't round trip on the EBCDIC code pages,
// so we don't check that code point in the sanity check.
if (j != 0x0025) {
chars[0] = parentValue;
int parentRoundTrip = new String(chars).getBytes(parentEnc)[0];
// This is a sanity check -- we aren't really testing the parent
// encoder here.
if (parentRoundTrip != j) {
pass = false;
System.out.println("Error: Encoder " + parentEnc +
" fails round-trip: " + j +
" -> \\u" + Integer.toHexString(parentValue) +
" -> " + parentRoundTrip);
}
}
map[(j+0x100)&0xFF] = parentValue;
}
// Modify map with new expected values. Each pair has code point, parent value, euro value.
// Terminated by null.
while (DATA[i] != null) {
int codePoint = Integer.valueOf(DATA[i++], 16).intValue();
char expectedParentValue = DATA[i++].charAt(0);
char expectedEuroValue = DATA[i++].charAt(0);
// This is a sanity check -- we aren't really testing the parent
// encoder here.
if (map[codePoint] != expectedParentValue) {
pass = false;
System.out.println("Error: Encoder " + parentEnc +
" " + Integer.toHexString(codePoint) + " -> \\u" +
Integer.toHexString(map[codePoint]) + ", expected \\u" +
Integer.toHexString(expectedParentValue));
}
// Fill in new expected value
map[codePoint] = expectedEuroValue;
}
++i; // Skip over null at end of set
// Now verify the euro encoder
currentEnc = euroEnc;
for (int j=-128; j<128; ++j) {
bytes[0] = (byte)j;
char euroValue = new String(bytes, euroEnc).charAt(0);
chars[0] = euroValue;
// NOTE: 0x15 doesn't round trip on the EBCDIC code pages,
// so we don't check that code point in the sanity check.
if (j != 0x0015) {
int euroRoundTrip = new String(chars).getBytes(euroEnc)[0];
if (euroRoundTrip != j) {
pass = false;
System.out.println("Error: Encoder " + euroEnc +
" fails round-trip at " + j);
}
}
// Compare against the map
if (euroValue != map[(j+0x100)&0xFF]) {
pass = false;
System.out.println("Error: Encoder " + euroEnc +
" " + Integer.toHexString((j+0x100)&0xFF) + " -> \\u" +
Integer.toHexString(euroValue) + ", expected \\u" +
Integer.toHexString(map[(j+0x100)&0xFF]));
}
}
} catch (UnsupportedEncodingException e) {
System.out.println("Unsupported encoding " + currentEnc);
pass = false;
while (i < DATA.length && DATA[i] != null) ++i;
++i; // Skip over null
}
}
if (!pass) {
throw new RuntimeException("Bug 4114080 - Euro encoder test failed");
}
}
static String[] DATA = {
// New converter, parent converter, [ code point that changed, parent code point value,
// euro code point value ], null
// Any number of changed code points may be specified, including zero.
"ISO8859_15_FDIS", "ISO8859_1",
"A4", "\u00A4", "\u20AC",
"A6", "\u00A6", "\u0160",
"A8", "\u00A8", "\u0161",
"B4", "\u00B4", "\u017D",
"B8", "\u00B8", "\u017E",
"BC", "\u00BC", "\u0152",
"BD", "\u00BD", "\u0153",
"BE", "\u00BE", "\u0178",
null,
// 923 is IBM's name for ISO 8859-15; make sure they're identical
"Cp923", "ISO8859_15_FDIS", null,
"Cp858", "Cp850", "D5", "\u0131", "\u20AC", null,
"Cp1140", "Cp037", "9F", "\u00A4", "\u20AC", null,
"Cp1141", "Cp273", "9F", "\u00A4", "\u20AC", null,
"Cp1142", "Cp277", "5A", "\u00A4", "\u20AC", null,
"Cp1143", "Cp278", "5A", "\u00A4", "\u20AC", null,
"Cp1144", "Cp280", "9F", "\u00A4", "\u20AC", null,
"Cp1145", "Cp284", "9F", "\u00A4", "\u20AC", null,
"Cp1146", "Cp285", "9F", "\u00A4", "\u20AC", null,
"Cp1147", "Cp297", "9F", "\u00A4", "\u20AC", null,
"Cp1148", "Cp500", "9F", "\u00A4", "\u20AC", null,
"Cp1149", "Cp871", "9F", "\u00A4", "\u20AC", null,
};
}

View File

@ -0,0 +1,90 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
* @bug 6196991
* @summary Roundtrip Encoding/Decoding of just one ASCII char
* @author Martin Buchholz
*/
import java.util.*;
import java.nio.*;
import java.nio.charset.*;
public class FindASCIICodingBugs {
private static int failures = 0;
private static void check(boolean condition) {
if (! condition) {
new Error("test failed").printStackTrace();
failures++;
}
}
private static boolean equals(byte[] ba, ByteBuffer bb) {
if (ba.length != bb.limit())
return false;
for (int i = 0; i < ba.length; i++)
if (ba[i] != bb.get(i))
return false;
return true;
}
public static void main(String[] args) throws Exception {
for (Map.Entry<String,Charset> e
: Charset.availableCharsets().entrySet()) {
String csn = e.getKey();
Charset cs = e.getValue();
// Delete the following lines when these charsets are fixed!
if (csn.equals("x-JIS0208")) continue; // MalformedInput
if (csn.equals("JIS_X0212-1990")) continue; // MalformedInput
if (! cs.canEncode()) continue;
CharsetEncoder enc = cs.newEncoder();
CharsetDecoder dec = cs.newDecoder();
if (! enc.canEncode('A')) continue;
System.out.println(csn);
try {
byte[] bytes1 = "A".getBytes(csn);
ByteBuffer bb = enc.encode(CharBuffer.wrap(new char[]{'A'}));
check(equals(bytes1, bb));
check(new String(bytes1, csn).equals("A"));
CharBuffer cb = dec.decode(bb);
check(cb.toString().equals("A"));
} catch (Throwable t) {
t.printStackTrace();
failures++;
}
}
if (failures > 0)
throw new Exception(failures + "tests failed");
}
}

View File

@ -0,0 +1,78 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
* @bug 6378295
* @summary Roundtrip Encoding/Decoding of ASCII chars from 0x00-0x7f
*/
import java.util.*;
import java.nio.*;
import java.nio.charset.*;
public class FindASCIIRangeCodingBugs {
private static int failures = 0;
private static byte[] asciiBytes = new byte[0x80];
private static char[] asciiChars = new char[0x80];
private static String asciiString;
private static void check(String csn) throws Exception {
System.out.println(csn);
if (! Arrays.equals(asciiString.getBytes(csn), asciiBytes)) {
System.out.printf("%s -> bytes%n", csn);
failures++;
}
if (! new String(asciiBytes, csn).equals(asciiString)) {
System.out.printf("%s -> chars%n", csn);
failures++;
}
}
public static void main(String[] args) throws Exception {
for (int i = 0; i < 0x80; i++) {
asciiBytes[i] = (byte) i;
asciiChars[i] = (char) i;
}
asciiString = new String(asciiChars);
Charset ascii = Charset.forName("ASCII");
for (Map.Entry<String,Charset> e
: Charset.availableCharsets().entrySet()) {
String csn = e.getKey();
Charset cs = e.getValue();
if (!cs.contains(ascii) ||
csn.matches(".*2022.*") || //iso2022 family
csn.matches("x-windows-5022[0|1]") || //windows 2022jp
csn.matches(".*UTF-[16|32].*")) //multi-bytes
continue;
if (! cs.canEncode()) continue;
try {
check(csn);
} catch (Throwable t) {
t.printStackTrace();
failures++;
}
}
if (failures > 0)
throw new Exception(failures + "tests failed");
}
}

View File

@ -0,0 +1,93 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 5066863 5066867 5066874 5066879 5066884 5066887
@summary canEncode() false iff encode() throws CharacterCodingException
@run main/timeout=1200 FindCanEncodeBugs
@author Martin Buchholz
*/
import java.util.*;
import java.nio.charset.*;
import java.nio.*;
public class FindCanEncodeBugs {
static boolean encodable1(CharsetEncoder enc, char c) {
enc.reset();
return enc.canEncode(c);
}
static boolean encodable2(CharsetEncoder enc, char c) {
enc.reset();
try { enc.encode(CharBuffer.wrap(new char[]{c})); return true; }
catch (CharacterCodingException e) { return false; }
}
public static void main(String[] args) throws Exception {
int failures = 0;
for (Map.Entry<String,Charset> e
: Charset.availableCharsets().entrySet()) {
String csn = e.getKey();
Charset cs = e.getValue();
if (! cs.canEncode() ||
csn.matches("x-COMPOUND_TEXT") ||
csn.matches("x-ISO-2022-CN-CNS") || // ISO2022_CN_CNS supports less
csn.matches("(x-)?IBM(970).*")) // Broken as of 2004-07
continue;
//System.out.println(csn);
CharsetEncoder enc = cs.newEncoder();
for (int i = Character.MIN_VALUE; i <= Character.MAX_VALUE; i++) {
boolean encodable1 = encodable1(enc, (char)i);
boolean encodable2 = encodable2(enc, (char)i);
if (encodable1 != encodable2) {
int start = i;
int end = i;
for (int j = i;
j <= '\uffff' &&
encodable1(enc, (char)j) == encodable1 &&
encodable2(enc, (char)j) == encodable2;
j++)
end = j;
System.out.printf("charset=%-18s canEncode=%-5b ",
csn, encodable1);
if (start == end)
System.out.printf("\'\\u%04x\'%n", start);
else
System.out.printf("\'\\u%04x\' - \'\\u%04x\'%n",
start, end);
i = end;
failures++;
}
}
}
if (failures > 0)
throw new Exception(failures + " failures");
}
}

View File

@ -0,0 +1,442 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6380723
* @summary Decode many byte sequences in many ways
* @run main/timeout=1800 FindDecoderBugs
* @author Martin Buchholz
*/
import java.util.*;
import java.util.regex.*;
import java.nio.*;
import java.nio.charset.*;
public class FindDecoderBugs {
static boolean isBroken(String csn) {
if (csn.equals("x-COMPOUND_TEXT")) return true;
return false;
}
static <T extends Comparable<? super T>> List<T> sort(Collection<T> c) {
List<T> list = new ArrayList<T>(c);
Collections.sort(list);
return list;
}
static class TooManyFailures extends RuntimeException {
private static final long serialVersionUID = 0L;
}
static String string(byte[] a) {
final StringBuilder sb = new StringBuilder();
for (byte b : a) {
if (sb.length() != 0) sb.append(' ');
sb.append(String.format("%02x", b & 0xff));
}
return sb.toString();
}
static String string(char[] a) {
final StringBuilder sb = new StringBuilder();
for (char c : a) {
if (sb.length() != 0) sb.append(' ');
sb.append(String.format("\\u%04x", (int) c));
}
return sb.toString();
}
static class Reporter {
// Some machinery to make sure only a small number of errors
// that are "too similar" are reported.
static class Counts extends HashMap<String, Long> {
private static final long serialVersionUID = -1;
long inc(String signature) {
Long count = get(signature);
if (count == null) count = 0L;
put(signature, count+1);
return count+1;
}
}
final Counts failureCounts = new Counts();
final static long maxFailures = 2;
final static Pattern hideBytes = Pattern.compile("\"[0-9a-f ]+\"");
final static Pattern hideChars = Pattern.compile("\\\\u[0-9a-f]{4}");
boolean bug(String format, Object... args) {
String signature = String.format(format, args);
signature = hideBytes.matcher(signature).replaceAll("\"??\"");
signature = hideChars.matcher(signature).replaceAll("\\u????");
failed++;
if (failureCounts.inc(signature) <= maxFailures) {
System.out.printf(format, args);
System.out.println();
return true;
}
return false;
}
void summarize() {
for (String key : sort(failureCounts.keySet()))
System.out.printf("-----%n%s%nfailures=%d%n",
key, failureCounts.get(key));
}
}
static final Reporter reporter = new Reporter();
static class Result {
final int limit;
final int ipos;
final boolean direct;
final byte[] ia;
final char[] oa;
final CoderResult cr;
Result(ByteBuffer ib, CharBuffer ob, CoderResult cr) {
ipos = ib.position();
ia = toArray(ib);
oa = toArray(ob);
direct = ib.isDirect();
limit = ob.limit();
this.cr = cr;
}
static byte[] toArray(ByteBuffer b) {
int pos = b.position();
byte[] a = new byte[b.limit()];
b.position(0);
b.get(a);
b.position(pos);
return a;
}
static char[] toArray(CharBuffer b) {
char[] a = new char[b.position()];
b.position(0);
b.get(a);
return a;
}
static boolean eq(Result x, Result y) {
return x == y ||
(x != null && y != null &&
(Arrays.equals(x.oa, y.oa) &&
x.ipos == y.ipos &&
x.cr == y.cr));
}
public String toString() {
return String.format("\"%s\"[%d/%d] => %s \"%s\"[%d/%d]%s",
string(ia), ipos, ia.length,
cr, string(oa), oa.length, limit,
(direct ? " (direct)" : ""));
}
}
// legend: r=regular d=direct In=Input Ou=Output
static final int maxBufSize = 20;
static final ByteBuffer[] ribs = new ByteBuffer[maxBufSize];
static final ByteBuffer[] dibs = new ByteBuffer[maxBufSize];
static final CharBuffer[] robs = new CharBuffer[maxBufSize];
static final CharBuffer[] dobs = new CharBuffer[maxBufSize];
static {
for (int i = 0; i < maxBufSize; i++) {
ribs[i] = ByteBuffer.allocate(i);
dibs[i] = ByteBuffer.allocateDirect(i);
robs[i] = CharBuffer.allocate(i);
dobs[i] = ByteBuffer.allocateDirect(i*2).asCharBuffer();
}
}
static class CharsetTester {
private final Charset cs;
private static final long maxFailures = 5;
private long failures = 0;
// private static final long maxCharsetFailures = Long.MAX_VALUE;
private static final long maxCharsetFailures = 10000L;
private final long failed0 = failed;
CharsetTester(Charset cs) {
this.cs = cs;
}
static boolean bug(String format, Object... args) {
return reporter.bug(format, args);
}
Result recode(ByteBuffer ib, CharBuffer ob) {
try {
char canary = '\u4242';
ib.clear(); // Prepare to read
ob.clear(); // Prepare to write
for (int i = 0; i < ob.limit(); i++)
ob.put(i, canary);
CharsetDecoder coder = cs.newDecoder();
CoderResult cr = coder.decode(ib, ob, false);
equal(ib.limit(), ib.capacity());
equal(ob.limit(), ob.capacity());
Result r = new Result(ib, ob, cr);
if (cr.isError())
check(cr.length() > 0);
if (cr.isOverflow() && ob.remaining() > 10)
bug("OVERFLOW, but there's lots of room: %s %s",
cs, r);
// if (cr.isOverflow() && ib.remaining() == 0)
// bug("OVERFLOW, yet remaining() == 0: %s %s",
// cs, r);
if (cr.isError() && ib.remaining() < cr.length())
bug("remaining() < CoderResult.length(): %s %s",
cs, r);
// if (ib.position() == 0 && ob.position() > 0)
// reporter. bug("output only if input consumed: %s %s",
// cs, r);
// Should we warn if cr.isUnmappable() ??
CoderResult cr2 = coder.decode(ib, ob, false);
if (ib.position() != r.ipos ||
ob.position() != r.oa.length ||
cr != cr2)
bug("Coding operation not idempotent: %s%n %s%n %s",
cs, r, new Result(ib, ob, cr2));
if (ob.position() < ob.limit() &&
ob.get(ob.position()) != canary)
bug("Buffer overrun: %s %s %s",
cs, r, ob.get(ob.position()));
return r;
} catch (Throwable t) {
if (bug("Unexpected exception: %s %s %s",
cs, t.getClass().getSimpleName(),
new Result(ib, ob, null)))
t.printStackTrace();
return null;
}
}
Result recode2(byte[] ia, int n) {
int len = ia.length;
ByteBuffer rib = ByteBuffer.wrap(ia);
ByteBuffer dib = dibs[len];
dib.clear(); dib.put(ia); dib.clear();
CharBuffer rob = robs[n];
CharBuffer dob = dobs[n];
equal(rob.limit(), n);
equal(dob.limit(), n);
check(dib.isDirect());
check(dob.isDirect());
Result r1 = recode(rib, rob);
Result r2 = recode(dib, dob);
if (r1 != null && r2 != null && ! Result.eq(r1, r2))
bug("Results differ for direct buffers: %s%n %s%n %s",
cs, r1, r2);
return r1;
}
Result test(byte[] ia) {
if (failed - failed0 >= maxCharsetFailures)
throw new TooManyFailures();
Result roomy = recode2(ia, maxBufSize - 1);
if (roomy == null) return roomy;
int olen = roomy.oa.length;
if (olen > 0) {
if (roomy.ipos == roomy.ia.length) {
Result perfectFit = recode2(ia, olen);
if (! Result.eq(roomy, perfectFit))
bug("Results differ: %s%n %s%n %s",
cs, roomy, perfectFit);
}
for (int i = 0; i < olen; i++) {
Result claustrophobic = recode2(ia, i);
if (claustrophobic == null) return roomy;
if (roomy.cr.isUnderflow() &&
! claustrophobic.cr.isOverflow())
bug("Expected OVERFLOW: %s%n %s%n %s",
cs, roomy, claustrophobic);
}
}
return roomy;
}
void testExhaustively(byte[] prefix, int n) {
int len = prefix.length;
byte[] ia = Arrays.copyOf(prefix, len + 1);
for (int i = 0; i < 0x100; i++) {
ia[len] = (byte) i;
if (n == 1)
test(ia);
else
testExhaustively(ia, n - 1);
}
}
void testRandomly(byte[] prefix, int n) {
int len = prefix.length;
byte[] ia = Arrays.copyOf(prefix, len + n);
for (int i = 0; i < 10000; i++) {
for (int j = 0; j < n; j++)
ia[len + j] = randomByte();
test(ia);
}
}
void testPrefix(byte[] prefix) {
if (prefix.length > 0)
System.out.printf("Testing prefix %s%n", string(prefix));
test(prefix);
testExhaustively(prefix, 1);
testExhaustively(prefix, 2);
// Can you spare a week of CPU time?
// testExhaustively(cs, tester, prefix, 3);
testRandomly(prefix, 3);
testRandomly(prefix, 4);
}
}
private final static Random rnd = new Random();
private static byte randomByte() {
return (byte) rnd.nextInt(0x100);
}
private static byte[] randomBytes(int len) {
byte[] a = new byte[len];
for (int i = 0; i < len; i++)
a[i] = randomByte();
return a;
}
private static final byte SS2 = (byte) 0x8e;
private static final byte SS3 = (byte) 0x8f;
private static final byte ESC = (byte) 0x1b;
private static final byte SO = (byte) 0x0e;
private static final byte SI = (byte) 0x0f;
private final static byte[][] stateChangers = {
{SS2}, {SS3}, {SO}, {SI}
};
private final static byte[][]escapeSequences = {
{ESC, '(', 'B'},
{ESC, '(', 'I'},
{ESC, '(', 'J'},
{ESC, '$', '@'},
{ESC, '$', 'A'},
{ESC, '$', ')', 'A'},
{ESC, '$', ')', 'C'},
{ESC, '$', ')', 'G'},
{ESC, '$', '*', 'H'},
{ESC, '$', '+', 'I'},
{ESC, '$', 'B'},
{ESC, 'N'},
{ESC, 'O'},
{ESC, '$', '(', 'D'},
};
private static boolean isStateChanger(Charset cs, byte[] ia) {
Result r = new CharsetTester(cs).recode2(ia, 9);
return r == null ? false :
(r.cr.isUnderflow() &&
r.ipos == ia.length &&
r.oa.length == 0);
}
private final static byte[][] incompletePrefixes = {
{ESC},
{ESC, '('},
{ESC, '$'},
{ESC, '$', '(',},
};
private static boolean isIncompletePrefix(Charset cs, byte[] ia) {
Result r = new CharsetTester(cs).recode2(ia, 9);
return r == null ? false :
(r.cr.isUnderflow() &&
r.ipos == 0 &&
r.oa.length == 0);
}
private static void testCharset(Charset cs) throws Throwable {
final String csn = cs.name();
if (isBroken(csn)) {
System.out.printf("Skipping possibly broken charset %s%n", csn);
return;
}
System.out.println(csn);
CharsetTester tester = new CharsetTester(cs);
tester.testPrefix(new byte[0]);
if (! csn.matches("(?:x-)?(?:UTF|JIS(?:_X)?0).*")) {
for (byte[] prefix : stateChangers)
if (isStateChanger(cs, prefix))
tester.testPrefix(prefix);
for (byte[] prefix : incompletePrefixes)
if (isIncompletePrefix(cs, prefix))
tester.testPrefix(prefix);
if (isIncompletePrefix(cs, new byte[] {ESC}))
for (byte[] prefix : escapeSequences)
if (isStateChanger(cs, prefix))
tester.testPrefix(prefix);
}
}
private static void realMain(String[] args) {
for (Charset cs : sort(Charset.availableCharsets().values())) {
try {
testCharset(cs);
} catch (TooManyFailures e) {
System.out.printf("Too many failures for %s%n", cs);
} catch (Throwable t) {
unexpected(t);
}
}
reporter.summarize();
}
//--------------------- Infrastructure ---------------------------
static volatile long passed = 0, failed = 0;
static void pass() {passed++;}
static void fail() {failed++; Thread.dumpStack();}
static void fail(String format, Object... args) {
System.out.println(String.format(format, args)); failed++;}
static void fail(String msg) {System.out.println(msg); fail();}
static void unexpected(Throwable t) {failed++; t.printStackTrace();}
static void check(boolean cond) {if (cond) pass(); else fail();}
static void equal(Object x, Object y) {
if (x == null ? y == null : x.equals(y)) pass();
else fail(x + " not equal to " + y);}
public static void main(String[] args) throws Throwable {
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
}

View File

@ -0,0 +1,529 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6233345 6381699 6381702 6381705 6381706
* @summary Encode many char sequences in many ways
* @run main/timeout=1200 FindEncoderBugs
* @author Martin Buchholz
*/
import java.util.*;
import java.util.regex.*;
import java.nio.*;
import java.nio.charset.*;
public class FindEncoderBugs {
static boolean isBroken(String csn) {
if (csn.equals("x-COMPOUND_TEXT")) return true;
if (csn.equals("x-IBM834")) return true; // stateful korean
if (csn.equals("x-IBM933")) return true; // stateful korean
if (csn.equals("x-IBM970")) return true; // stateful korean
if (csn.equals("x-IBM949")) return true; // stateful korean
if (csn.equals("x-IBM949C")) return true; // stateful korean
return false;
}
static <T extends Comparable<? super T>> List<T> sort(Collection<T> c) {
List<T> list = new ArrayList<T>(c);
Collections.sort(list);
return list;
}
static class TooManyFailures extends RuntimeException {
private static final long serialVersionUID = 0L;
}
static String string(byte[] a) {
final StringBuilder sb = new StringBuilder();
for (byte b : a) {
if (sb.length() != 0) sb.append(' ');
sb.append(String.format("%02x", b & 0xff));
}
return sb.toString();
}
static String string(char[] a) {
final StringBuilder sb = new StringBuilder();
for (char c : a) {
if (sb.length() != 0) sb.append(' ');
sb.append(String.format("\\u%04x", (int) c));
}
return sb.toString();
}
static class Reporter {
// Some machinery to make sure only a small number of errors
// that are "too similar" are reported.
static class Counts extends HashMap<String, Long> {
private static final long serialVersionUID = -1;
long inc(String signature) {
Long count = get(signature);
if (count == null) count = 0L;
put(signature, count+1);
return count+1;
}
}
final Counts failureCounts = new Counts();
final static long maxFailures = 2;
final static Pattern hideBytes = Pattern.compile("\"[0-9a-f ]+\"");
final static Pattern hideChars = Pattern.compile("\\\\u[0-9a-f]{4}");
boolean bug(String format, Object... args) {
String signature = String.format(format, args);
// signature = hideBytes.matcher(signature).replaceAll("\"??\"");
// signature = hideChars.matcher(signature).replaceAll("\\u????");
failed++;
if (failureCounts.inc(signature) <= maxFailures) {
System.out.printf(format, args);
System.out.println();
return true;
}
return false;
}
void summarize() {
for (String key : sort(failureCounts.keySet()))
System.out.printf("-----%n%s%nfailures=%d%n",
key, failureCounts.get(key));
}
}
static final Reporter reporter = new Reporter();
static class Result {
final int limit;
final int ipos;
final boolean direct;
final char[] ia;
final byte[] oa;
final CoderResult cr;
private static byte[] toByteArray(ByteBuffer bb) {
byte[] bytes = new byte[bb.position()];
for (int i = 0; i < bytes.length; i++)
bytes[i] = bb.get(i);
return bytes;
}
Result(CharBuffer ib, ByteBuffer ob, CoderResult cr) {
ipos = ib.position();
ia = toArray(ib);
oa = toArray(ob);
direct = ib.isDirect();
limit = ob.limit();
this.cr = cr;
}
static char[] toArray(CharBuffer b) {
int pos = b.position();
char[] a = new char[b.limit()];
b.position(0);
b.get(a);
b.position(pos);
return a;
}
static byte[] toArray(ByteBuffer b) {
byte[] a = new byte[b.position()];
b.position(0);
b.get(a);
return a;
}
static boolean eq(Result x, Result y) {
return x == y ||
(x != null && y != null &&
(Arrays.equals(x.oa, y.oa) &&
x.ipos == y.ipos &&
x.cr == y.cr));
}
public String toString() {
return String.format("\"%s\"[%d/%d] => %s \"%s\"[%d/%d]%s",
string(ia), ipos, ia.length,
cr, string(oa), oa.length, limit,
(direct ? " (direct)" : ""));
}
}
static class CharsetTester {
private final Charset cs;
private final boolean hasBom;
private static final int maxFailures = 5;
private int failures = 0;
// private static final long maxCharsetFailures = Long.MAX_VALUE;
private static final long maxCharsetFailures = 10000L;
private final long failed0 = failed;
// legend: r=regular d=direct In=Input Ou=Output
static final int maxBufSize = 20;
static final CharBuffer[] rInBuffers = new CharBuffer[maxBufSize];
static final CharBuffer[] dInBuffers = new CharBuffer[maxBufSize];
static final ByteBuffer[] rOuBuffers = new ByteBuffer[maxBufSize];
static final ByteBuffer[] dOuBuffers = new ByteBuffer[maxBufSize];
static {
for (int i = 0; i < maxBufSize; i++) {
rInBuffers[i] = CharBuffer.allocate(i);
dInBuffers[i] = ByteBuffer.allocateDirect(i*2).asCharBuffer();
rOuBuffers[i] = ByteBuffer.allocate(i);
dOuBuffers[i] = ByteBuffer.allocateDirect(i);
}
}
CharsetTester(Charset cs) {
this.cs = cs;
this.hasBom =
cs.name().matches(".*BOM.*") ||
cs.name().equals("UTF-16");
}
static boolean bug(String format, Object... args) {
return reporter.bug(format, args);
}
static boolean hasBom(byte[] a) {
switch (a.length) {
case 2: case 4:
int sum = 0;
for (byte x : a)
sum += x;
return sum == (byte) 0xfe + (byte) 0xff;
default: return false;
}
}
void testSurrogates() {
int failures = 0;
for (int i = 0; i < 10; i++) {
Result r = test(new char[] { randomHighSurrogate() });
if (r == null) break;
if (! (r.cr.isUnderflow() &&
r.ipos == 0))
bug("Lone high surrogate not UNDERFLOW: %s %s",
cs, r);
}
for (int i = 0; i < 10; i++) {
Result r = test(new char[] { randomLowSurrogate() });
if (r == null) break;
if (! (r.cr.isMalformed() && r.cr.length() == 1))
bug("Lone low surrogate not MALFORMED[1]: %s %s",
cs, r);
}
char[] chars = new char[2];
for (int i = 0; i < 10; i++) {
chars[0] = randomLowSurrogate(); // Always illegal
chars[1] = randomChar();
Result r = test(chars);
if (r == null) break;
if (! (r.cr.isMalformed() &&
r.cr.length() == 1 &&
(r.ipos == 0 || (hasBom && hasBom(r.oa))))) {
if (failures++ > 5) return;
bug("Unpaired low surrogate not MALFORMED[1]: %s %s",
cs, r);
}
}
for (int i = 0; i < 10; i++) {
chars[0] = randomHighSurrogate();
do {
chars[1] = randomChar();
} while (Character.isLowSurrogate(chars[1]));
Result r = test(chars);
if (r == null) break;
if (! (r.cr.isMalformed() &&
r.cr.length() == 1 &&
(r.ipos == 0 || (hasBom && hasBom(r.oa))))) {
if (failures++ > 5) return;
bug("Unpaired high surrogate not MALFORMED[1]: %s %s",
cs, r);
}
}
for (int i = 0; i < 1000; i++) {
chars[0] = randomHighSurrogate();
chars[1] = randomLowSurrogate();
Result r = test(chars);
if (r == null) break;
if (! ((r.cr.isUnmappable() &&
r.cr.length() == 2 &&
r.oa.length == 0)
||
(r.cr.isUnderflow() &&
r.oa.length > 0 &&
r.ipos == 2))) {
if (failures++ > 5) return;
bug("Legal supplementary character bug: %s %s",
cs, r);
}
}
}
// if (! (r.cr.isMalformed() &&
// r.cr.length() == 1 &&
// (rob.position() == 0 || hasBom(rob)))) {
// if (failures++ > 5) return;
// bug("Unpaired surrogate not malformed: %s %s",
// cs, r);
// }
// }
// dib.clear(); dib.put(chars); dib.flip();
// rib.position(0);
// rob.clear(); rob.limit(lim);
// for (CharBuffer ib : new CharBuffer[] { rib, dib }) {
// Result r = recode(ib, rob);
// if (! (r.cr.isMalformed() &&
// r.cr.length() == 1 &&
// (rob.position() == 0 || hasBom(rob)))) {
// if (failures++ > 5) return;
// bug("Unpaired surrogate not malformed: %s %s",
// cs, r);
// }
// }
// //}
// for (int i = 0; i < 10000; i++) {
// chars[0] = randomHighSurrogate();
// chars[1] = randomLowSurrogate();
// dib.clear(); dib.put(chars); dib.flip();
// rib.position(0);
// rob.clear(); rob.limit(lim);
// for (CharBuffer ib : new CharBuffer[] { rib, dib }) {
// Result r = recode(ib, rob);
// if (! ((r.cr.isUnmappable() &&
// r.cr.length() == 2 &&
// rob.position() == 0)
// ||
// (r.cr.isUnderflow() &&
// rob.position() > 0 &&
// ib.position() == 2))) {
// if (failures++ > 5) return;
// bug("Legal supplementary character bug: %s %s",
// cs, r);
// }
// }
// }
// }
// }
Result recode(CharBuffer ib, ByteBuffer ob) {
try {
byte canary = 22;
ib.clear(); // Prepare to read
ob.clear(); // Prepare to write
for (int i = 0; i < ob.limit(); i++)
ob.put(i, canary);
CharsetEncoder coder = cs.newEncoder();
CoderResult cr = coder.encode(ib, ob, false);
equal(ib.limit(), ib.capacity());
equal(ob.limit(), ob.capacity());
Result r = new Result(ib, ob, cr);
if (cr.isError())
check(cr.length() > 0);
if (cr.isOverflow() && ob.remaining() > 10)
bug("OVERFLOW, but there's lots of room: %s %s",
cs, r);
// if (cr.isOverflow() && ib.remaining() == 0 && ! hasBom)
// bug("OVERFLOW, yet remaining() == 0: %s %s",
// cs, r);
if (cr.isError() && ib.remaining() < cr.length())
bug("remaining() < CoderResult.length(): %s %s",
cs, r);
// if (ib.position() == 0
// && ob.position() > 0
// && ! hasBom(r.oa))
// bug("output only if input consumed: %s %s",
// cs, r);
CoderResult cr2 = coder.encode(ib, ob, false);
if (ib.position() != r.ipos ||
ob.position() != r.oa.length ||
cr != cr2)
bug("Coding operation not idempotent: %s%n %s%n %s",
cs, r, new Result(ib, ob, cr2));
if (ob.position() < ob.limit() &&
ob.get(ob.position()) != canary)
bug("Buffer overrun: %s %s %s",
cs, r, ob.get(ob.position()));
return r;
} catch (Throwable t) {
if (bug("Unexpected exception: %s %s %s",
cs, t.getClass().getSimpleName(),
new Result(ib, ob, null)))
t.printStackTrace();
return null;
}
}
Result recode2(char[] ia, int n) {
int len = ia.length;
CharBuffer rib = CharBuffer.wrap(ia);
CharBuffer dib = dInBuffers[len];
dib.clear(); dib.put(ia); dib.clear();
ByteBuffer rob = rOuBuffers[n];
ByteBuffer dob = dOuBuffers[n];
equal(rob.limit(), n);
equal(dob.limit(), n);
check(dib.isDirect());
check(dob.isDirect());
Result r1 = recode(rib, rob);
Result r2 = recode(dib, dob);
if (r1 != null && r2 != null && ! Result.eq(r1, r2))
bug("Results differ for direct buffers: %s%n %s%n %s",
cs, r1, r2);
return r1;
}
Result test(char[] ia) {
if (failed - failed0 >= maxCharsetFailures)
throw new TooManyFailures();
Result roomy = recode2(ia, maxBufSize - 1);
if (roomy == null) return roomy;
int olen = roomy.oa.length;
if (olen > 0) {
if (roomy.ipos == roomy.ia.length) {
Result perfectFit = recode2(ia, olen);
if (! Result.eq(roomy, perfectFit))
bug("Results differ: %s%n %s%n %s",
cs, roomy, perfectFit);
}
for (int i = 0; i < olen; i++) {
Result claustrophobic = recode2(ia, i);
if (claustrophobic == null) return roomy;
if (roomy.cr.isUnderflow() &&
! claustrophobic.cr.isOverflow())
bug("Expected OVERFLOW: %s%n %s%n %s",
cs, roomy, claustrophobic);
}
}
return roomy;
}
void testExhaustively(char[] prefix, int n) {
int len = prefix.length;
char[] ia = Arrays.copyOf(prefix, len + 1);
for (int i = 0; i < 0x10000; i++) {
ia[len] = (char) i;
if (n == 1)
test(ia);
else
testExhaustively(ia, n - 1);
}
}
void testRandomly(char[] prefix, int n) {
int len = prefix.length;
char[] ia = Arrays.copyOf(prefix, len + n);
for (int i = 0; i < 10000; i++) {
for (int j = 0; j < n; j++)
ia[len + j] = randomChar();
test(ia);
}
}
void testPrefix(char[] prefix) {
if (prefix.length > 0)
System.out.printf("Testing prefix %s%n", string(prefix));
test(prefix);
testExhaustively(prefix, 1);
// Can you spare a year of CPU time?
//testExhaustively(prefix, 2);
testRandomly(prefix, 2);
testRandomly(prefix, 3);
}
}
private final static Random rnd = new Random();
private static char randomChar() {
return (char) rnd.nextInt(Character.MAX_VALUE);
}
private static char randomHighSurrogate() {
return (char) (Character.MIN_HIGH_SURROGATE + rnd.nextInt(1024));
}
private static char randomLowSurrogate() {
return (char) (Character.MIN_LOW_SURROGATE + rnd.nextInt(1024));
}
private static void testCharset(Charset cs) throws Throwable {
if (! cs.canEncode())
return;
final String csn = cs.name();
if (isBroken(csn)) {
System.out.printf("Skipping possibly broken charset %s%n", csn);
return;
}
System.out.println(csn);
CharsetTester tester = new CharsetTester(cs);
tester.testSurrogates();
tester.testPrefix(new char[] {});
if (csn.equals("x-ISCII91")) {
System.out.println("More ISCII testing...");
new CharsetTester(cs).testPrefix(new char[]{'\u094d'}); // Halant
new CharsetTester(cs).testPrefix(new char[]{'\u093c'}); // Nukta
}
}
private static void realMain(String[] args) {
for (Charset cs : sort(Charset.availableCharsets().values())) {
try {
testCharset(cs);
} catch (TooManyFailures e) {
System.out.printf("Too many failures for %s%n", cs);
} catch (Throwable t) {
unexpected(t);
}
}
reporter.summarize();
}
//--------------------- Infrastructure ---------------------------
static volatile long passed = 0, failed = 0;
static void pass() {passed++;}
static void fail() {failed++; Thread.dumpStack();}
static void fail(String format, Object... args) {
System.out.println(String.format(format, args)); failed++;}
static void fail(String msg) {System.out.println(msg); fail();}
static void unexpected(Throwable t) {failed++; t.printStackTrace();}
static void check(boolean cond) {if (cond) pass(); else fail();}
static void equal(Object x, Object y) {
if (x == null ? y == null : x.equals(y)) pass();
else fail(x + " not equal to " + y);}
public static void main(String[] args) throws Throwable {
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
}

View File

@ -0,0 +1,169 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 5058133 6233345 6381699 6381702 6381705 6381706
* @summary Check that all one-char sequences can be encoded by all charsets
* @run main/timeout=1200 FindOneCharEncoderBugs
* @author Martin Buchholz
*/
import java.util.*;
import java.nio.*;
import java.nio.charset.*;
public class FindOneCharEncoderBugs {
final static String[] brokenCharsets = {
// Delete the following lines when these charsets are fixed!
"x-IBM970",
"x-COMPOUND_TEXT", // Direct buffers not supported
};
private static boolean equals(byte[] ba, ByteBuffer bb) {
if (ba.length != bb.limit())
return false;
for (int i = 0; i < ba.length; i++)
if (ba[i] != bb.get(i))
return false;
return true;
}
private static String toString(byte[] bytes) {
final StringBuilder sb = new StringBuilder();
for (byte b : bytes) {
if (sb.length() != 0) sb.append(' ');
sb.append(String.format("%02x", (int)b));
}
return sb.toString();
}
private static String toString(ByteBuffer bb) {
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < bb.limit(); i++) {
if (sb.length() != 0) sb.append(' ');
sb.append(String.format("%02x", (int)bb.get(i)));
}
return sb.toString();
}
private static ByteBuffer convert(Charset cs, char c, CharBuffer cb) throws Throwable {
cb.clear(); cb.put(c); cb.flip();
return cs.newEncoder()
.onUnmappableCharacter(CodingErrorAction.REPLACE)
.onMalformedInput(CodingErrorAction.REPLACE)
.encode(cb);
}
/** Returns a direct CharBuffer with the same capacity as ordinary CharBuffer ocb */
private static CharBuffer directCharBuffer(CharBuffer ocb) {
final CharBuffer dcb =
ByteBuffer.allocateDirect(ocb.capacity() * Character.SIZE / Byte.SIZE)
.asCharBuffer();
check(! ocb.isDirect());
check( dcb.isDirect());
equal(ocb.capacity(), dcb.capacity());
return dcb;
}
private static void testChar(byte[] expected, CharBuffer cb, Charset cs, char c) {
try {
final ByteBuffer bb = convert(cs, c, cb);
if (! equals(expected, bb))
fail("bytes differ charset=%s direct=%s char=\\u%04x%n%s%n%s",
cs, cb.isDirect(), (int)c,
toString(expected), toString(bb));
} catch (Throwable t) {
System.out.printf("Unexpected exception charset=%s direct=%s char=\\u%04x%n",
cs, cb.isDirect(), (int)c);
unexpected(t);
failed++;
}
}
private static void testCharset(Charset cs) throws Throwable {
if (! cs.canEncode())
return;
final String csn = cs.name();
for (String n : brokenCharsets)
if (csn.equals(n)) {
System.out.printf("Skipping possibly broken charset %s%n", csn);
return;
}
System.out.println(csn);
final char[] theChar = new char[1];
final CharBuffer ocb = CharBuffer.allocate(1);
final CharBuffer dcb = directCharBuffer(ocb);
final int maxFailuresPerCharset = 5;
final int failed0 = failed;
for (char c = '\u0000';
(c+1 != 0x10000) && (failed - failed0 < maxFailuresPerCharset);
c++) {
theChar[0] = c;
byte[] bytes = new String(theChar).getBytes(csn);
if (bytes.length == 0)
fail("Empty output?! charset=%s char=\\u%04x", cs, (int)c);
testChar(bytes, ocb, cs, c);
testChar(bytes, dcb, cs, c);
}
}
private static void realMain(String[] args) {
for (Charset cs : Charset.availableCharsets().values()) {
try { testCharset(cs); }
catch (Throwable t) { unexpected(t); }
}
}
//--------------------- Infrastructure ---------------------------
static volatile int passed = 0, failed = 0;
static void pass() {passed++;}
static void fail() {failed++; Thread.dumpStack();}
static void fail(String format, Object... args) {
System.out.println(String.format(format, args)); failed++;}
static void fail(String msg) {System.out.println(msg); fail();}
static void unexpected(Throwable t) {failed++; t.printStackTrace();}
static void check(boolean cond) {if (cond) pass(); else fail();}
static void equal(Object x, Object y) {
if (x == null ? y == null : x.equals(y)) pass();
else fail(x + " not equal to " + y);}
public static void main(String[] args) throws Throwable {
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
private static abstract class Fun {abstract void f() throws Throwable;}
static void THROWS(Class<? extends Throwable> k, Fun... fs) {
for (Fun f : fs)
try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
catch (Throwable t) {
if (k.isAssignableFrom(t.getClass())) pass();
else unexpected(t);}}
private static abstract class CheckedThread extends Thread {
abstract void realRun() throws Throwable;
public void run() {
try {realRun();} catch (Throwable t) {unexpected(t);}}}
}

View File

@ -0,0 +1,54 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4715330
@summary Check MS932/windows-31j encoding (char->byte) for halfwidth katakana chars
*/
/*
* Tests encodeability of the Unicode defined Halfwidth Katakana
* characters using the MS932/windows-31j encoder
*/
public class HWKatakanaMS932EncodeTest {
public static void main(String[] args) throws Exception {
char[] testChars = new char[1];
byte[] testBytes = new byte[1];
int offset = 0;
String encoding = "windows-31j";
// Halfwidth Katakana chars run from U+FF61 --> U+FF9F
// and their native equivalents in Code page 932 run
// sequentially from 0xa1 --> 0xdf
for (int lsByte = 0x61 ; lsByte <= 0x9F; lsByte++, offset++) {
testChars[0] = (char) (lsByte | 0xFF00);
String s = new String(testChars);
testBytes = s.getBytes(encoding);
if ( testBytes[0] != (byte)(0xa1 + offset))
throw new Exception("failed Test");
}
}
}

View File

@ -0,0 +1,350 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4328178
@summary Performs baseline and regression test on the ISCII91 charset
*/
import java.io.*;
public class ISCIITest {
private static void failureReport() {
System.err.println ("Failed ISCII91 Regression Test");
}
private static void mapEquiv(int start,
int end,
String testName)
throws Exception
{
byte[] singleByte = new byte[1];
byte[] encoded = new byte[1];
for (int i = start; i <= end; i++ ) {
singleByte[0] = (byte) i;
try {
String unicodeStr =
new String (singleByte,"ISCII91");
if (i != (int)unicodeStr.charAt(0)) {
System.err.println ("FAILED ISCII91 Regression test"
+ "input byte is " + i );
throw new Exception("");
}
encoded = unicodeStr.getBytes("ISCII91");
if (encoded[0] != singleByte[0]) {
System.err.println("Encoding error " + testName);
throw new Exception("Failed ISCII91 Regression test");
}
} catch (UnsupportedEncodingException e) {
failureReport();
}
}
return;
}
private static void checkUnmapped(int start,
int end,
String testName)
throws Exception {
byte[] singleByte = new byte[1];
for (int i = start; i <= end; i++ ) {
singleByte[0] = (byte) i;
try {
String unicodeStr = new String (singleByte, "ISCII91");
if (unicodeStr.charAt(0) != '\uFFFD') {
System.err.println("FAILED " + testName +
"input byte is " + i );
throw new Exception ("Failed ISCII91 regression test");
}
} catch (UnsupportedEncodingException e) {
System.err.println("Unsupported character encoding");
}
}
return;
}
/*
*
*/
private static void checkRange(int start, int end,
char[] expectChars,
String testName)
throws Exception {
byte[] singleByte = new byte[1];
byte[] encoded = new byte[1];
int lookupOffset = 0;
for (int i=start; i <= end; i++ ) {
singleByte[0] = (byte) i;
String unicodeStr = new String (singleByte, "ISCII91");
if (unicodeStr.charAt(0) != expectChars[lookupOffset++]) {
throw new Exception ("Failed ISCII91 Regression Test");
}
encoded = unicodeStr.getBytes("ISCII");
}
return;
}
/*
* Tests the ISCII91 Indic character encoding
* as per IS 13194:1991 Bureau of Indian Standards.
*/
private static void test () throws Exception {
try {
// ISCII91 is an 8-byte encoding which retains the ASCII
// mappings in the lower half.
mapEquiv(0, 0x7f, "7 bit ASCII range");
// Checks a range of characters which are unmappable according
// to the standards.
checkUnmapped(0x81, 0x9f, "UNMAPPED");
// Vowel Modifier chars can be used to modify the vowel
// sound of the preceding consonant, vowel or matra character.
byte[] testByte = new byte[1];
char[] vowelModChars = {
'\u0901', // Vowel modifier Chandrabindu
'\u0902', // Vowel modifier Anuswar
'\u0903' // Vowel modifier Visarg
};
checkRange(0xa1, 0xa3, vowelModChars, "INDIC VOWEL MODIFIER CHARS");
char[] expectChars = {
'\u0905', // a4 -- Vowel A
'\u0906', // a5 -- Vowel AA
'\u0907', // a6 -- Vowel I
'\u0908', // a7 -- Vowel II
'\u0909', // a8 -- Vowel U
'\u090a', // a9 -- Vowel UU
'\u090b', // aa -- Vowel RI
'\u090e', // ab -- Vowel E ( Southern Scripts )
'\u090f', // ac -- Vowel EY
'\u0910', // ad -- Vowel AI
'\u090d', // ae -- Vowel AYE ( Devanagari Script )
'\u0912', // af -- Vowel O ( Southern Scripts )
'\u0913', // b0 -- Vowel OW
'\u0914', // b1 -- Vowel AU
'\u0911', // b2 -- Vowel AWE ( Devanagari Script )
};
checkRange(0xa4, 0xb2, expectChars, "INDIC VOWELS");
char[] expectConsChars =
{
'\u0915', // b3 -- Consonant KA
'\u0916', // b4 -- Consonant KHA
'\u0917', // b5 -- Consonant GA
'\u0918', // b6 -- Consonant GHA
'\u0919', // b7 -- Consonant NGA
'\u091a', // b8 -- Consonant CHA
'\u091b', // b9 -- Consonant CHHA
'\u091c', // ba -- Consonant JA
'\u091d', // bb -- Consonant JHA
'\u091e', // bc -- Consonant JNA
'\u091f', // bd -- Consonant Hard TA
'\u0920', // be -- Consonant Hard THA
'\u0921', // bf -- Consonant Hard DA
'\u0922', // c0 -- Consonant Hard DHA
'\u0923', // c1 -- Consonant Hard NA
'\u0924', // c2 -- Consonant Soft TA
'\u0925', // c3 -- Consonant Soft THA
'\u0926', // c4 -- Consonant Soft DA
'\u0927', // c5 -- Consonant Soft DHA
'\u0928', // c6 -- Consonant Soft NA
'\u0929', // c7 -- Consonant NA ( Tamil )
'\u092a', // c8 -- Consonant PA
'\u092b', // c9 -- Consonant PHA
'\u092c', // ca -- Consonant BA
'\u092d', // cb -- Consonant BHA
'\u092e', // cc -- Consonant MA
'\u092f', // cd -- Consonant YA
'\u095f', // ce -- Consonant JYA ( Bengali, Assamese & Oriya )
'\u0930', // cf -- Consonant RA
'\u0931', // d0 -- Consonant Hard RA ( Southern Scripts )
'\u0932', // d1 -- Consonant LA
'\u0933', // d2 -- Consonant Hard LA
'\u0934', // d3 -- Consonant ZHA ( Tamil & Malayalam )
'\u0935', // d4 -- Consonant VA
'\u0936', // d5 -- Consonant SHA
'\u0937', // d6 -- Consonant Hard SHA
'\u0938', // d7 -- Consonant SA
'\u0939', // d8 -- Consonant HA
};
checkRange(0xb3, 0xd8, expectConsChars, "INDIC CONSONANTS");
char[] matraChars = {
'\u093e', // da -- Vowel Sign AA
'\u093f', // db -- Vowel Sign I
'\u0940', // dc -- Vowel Sign II
'\u0941', // dd -- Vowel Sign U
'\u0942', // de -- Vowel Sign UU
'\u0943', // df -- Vowel Sign RI
'\u0946', // e0 -- Vowel Sign E ( Southern Scripts )
'\u0947', // e1 -- Vowel Sign EY
'\u0948', // e2 -- Vowel Sign AI
'\u0945', // e3 -- Vowel Sign AYE ( Devanagari Script )
'\u094a', // e4 -- Vowel Sign O ( Southern Scripts )
'\u094b', // e5 -- Vowel Sign OW
'\u094c', // e6 -- Vowel Sign AU
'\u0949' // e7 -- Vowel Sign AWE ( Devanagari Script )
};
// Matras or Vowel signs alter the implicit
// vowel sound associated with an Indic consonant.
checkRange(0xda, 0xe7, matraChars, "INDIC MATRAS");
char[] loneContextModifierChars = {
'\u094d', // e8 -- Vowel Omission Sign ( Halant )
'\u093c', // e9 -- Diacritic Sign ( Nukta )
'\u0964' // ea -- Full Stop ( Viram, Northern Scripts )
};
checkRange(0xe8, 0xea,
loneContextModifierChars, "LONE INDIC CONTEXT CHARS");
// Test Indic script numeral chars
// (as opposed to international numerals)
char[] expectNumeralChars =
{
'\u0966', // f1 -- Digit 0
'\u0967', // f2 -- Digit 1
'\u0968', // f3 -- Digit 2
'\u0969', // f4 -- Digit 3
'\u096a', // f5 -- Digit 4
'\u096b', // f6 -- Digit 5
'\u096c', // f7 -- Digit 6
'\u096d', // f8 -- Digit 7
'\u096e', // f9 -- Digit 8
'\u096f' // fa -- Digit 9
};
checkRange(0xf1, 0xfa,
expectNumeralChars, "NUMERAL/DIGIT CHARACTERS");
int lookupOffset = 0;
char[] expectNuktaSub = {
'\u0950',
'\u090c',
'\u0961',
'\u0960',
'\u0962',
'\u0963',
'\u0944',
'\u093d'
};
/*
* ISCII uses a number of code extension techniques
* to access a number of lesser used characters.
* The Nukta character which ordinarily signifies
* a diacritic is used in combination with existing
* characters to escape them to a different character.
* value.
*/
byte[] codeExtensionBytes = {
(byte)0xa1 , (byte)0xe9, // Chandrabindu + Nukta
// =>DEVANAGARI OM SIGN
(byte)0xa6 , (byte)0xe9, // Vowel I + Nukta
// => DEVANAGARI VOCALIC L
(byte)0xa7 , (byte)0xe9, // Vowel II + Nukta
// => DEVANAGARI VOCALIC LL
(byte)0xaa , (byte)0xe9, // Vowel RI + Nukta
// => DEVANAGARI VOCALIC RR
(byte)0xdb , (byte)0xe9, // Vowel sign I + Nukta
// => DEVANAGARI VOWEL SIGN VOCALIC L
(byte)0xdc , (byte)0xe9, // Vowel sign II + Nukta
// => DEVANAGARI VOWEL SIGN VOCALIC LL
(byte)0xdf , (byte)0xe9, // Vowel sign Vocalic R + Nukta
// => DEVANAGARI VOWEL SIGN VOCALIC RR
(byte)0xea , (byte)0xe9 // Full stop/Phrase separator + Nukta
// => DEVANAGARI SIGN AVAGRAHA
};
lookupOffset = 0;
byte[] bytePair = new byte[2];
for (int i=0; i < (codeExtensionBytes.length)/2; i++ ) {
bytePair[0] = (byte) codeExtensionBytes[lookupOffset++];
bytePair[1] = (byte) codeExtensionBytes[lookupOffset++];
String unicodeStr = new String (bytePair,"ISCII91");
if (unicodeStr.charAt(0) != expectNuktaSub[i]) {
throw new Exception("Failed Nukta Sub");
}
}
lookupOffset = 0;
byte[] comboBytes = {
(byte)0xe8 , (byte)0xe8, //HALANT + HALANT
(byte)0xe8 , (byte)0xe9 //HALANT + NUKTA aka. Soft Halant
};
char[] expectCombChars = {
'\u094d',
'\u200c',
'\u094d',
'\u200d'
};
for (int i=0; i < (comboBytes.length)/2; i++ ) {
bytePair[0] = (byte) comboBytes[lookupOffset++];
bytePair[1] = (byte) comboBytes[lookupOffset];
String unicodeStr = new String (bytePair, "ISCII91");
if (unicodeStr.charAt(0) != expectCombChars[lookupOffset-1]
&& unicodeStr.charAt(1) != expectCombChars[lookupOffset]) {
throw new Exception("Failed ISCII91 Regression Test");
}
lookupOffset++;
}
} catch (UnsupportedEncodingException e) {
System.err.println ("ISCII91 encoding not supported");
throw new Exception ("Failed ISCII91 Regression Test");
}
}
public static void main (String[] args) throws Exception {
test();
}
}

View File

@ -0,0 +1,454 @@
test0
$B!!(B $B!"(B $B!#(B $B!$(B $B!%(B $B!&(B $B!'(B $B!((B $B!)(B $B!*(B $B!+(B $B!,(B $B!-(B $B!.(B $B!/(B
$B!0(B $B!1(B $B!2(B $B!3(B $B!4(B $B!5(B $B!6(B $B!7(B $B!8(B $B!9(B $B!:(B $B!;(B $B!<(B $B!=(B $B!>(B $B!?(B
$B!A(B $B!B(B $B!C(B $B!D(B $B!E(B $B!F(B $B!G(B $B!H(B $B!I(B $B!J(B $B!K(B $B!L(B $B!M(B $B!N(B $B!O(B
$B!P(B $B!Q(B $B!R(B $B!S(B $B!T(B $B!U(B $B!V(B $B!W(B $B!X(B $B!Y(B $B!Z(B $B![(B $B!\(B $B!](B $B!^(B $B!_(B
$B!`(B $B!a(B $B!b(B $B!c(B $B!d(B $B!e(B $B!f(B $B!g(B $B!h(B $B!i(B $B!j(B $B!k(B $B!l(B $B!m(B $B!n(B $B!o(B
$B!p(B $B!q(B $B!r(B $B!s(B $B!t(B $B!u(B $B!v(B $B!w(B $B!x(B $B!y(B $B!z(B $B!{(B $B!|(B $B!}(B $B!~(B
$B"!(B $B""(B $B"#(B $B"$(B $B"%(B $B"&(B $B"'(B $B"((B $B")(B $B"*(B $B"+(B $B",(B $B"-(B $B".(B
$B":(B $B";(B $B"<(B $B"=(B $B">(B $B"?(B
$B"@(B $B"A(B $B"J(B $B"K(B $B"L(B $B"M(B $B"N(B $B"O(B
$B"P(B $B"\(B $B"](B $B"^(B $B"_(B
$B"`(B $B"a(B $B"b(B $B"c(B $B"d(B $B"e(B $B"f(B $B"g(B $B"h(B $B"i(B $B"j(B
$B"r(B $B"s(B $B"t(B $B"u(B $B"v(B $B"w(B $B"x(B $B"y(B $B"~(B
$B#0(B $B#1(B $B#2(B $B#3(B $B#4(B $B#5(B $B#6(B $B#7(B $B#8(B $B#9(B
$B#A(B $B#B(B $B#C(B $B#D(B $B#E(B $B#F(B $B#G(B $B#H(B $B#I(B $B#J(B $B#K(B $B#L(B $B#M(B $B#N(B $B#O(B
$B#P(B $B#Q(B $B#R(B $B#S(B $B#T(B $B#U(B $B#V(B $B#W(B $B#X(B $B#Y(B $B#Z(B
$B#a(B $B#b(B $B#c(B $B#d(B $B#e(B $B#f(B $B#g(B $B#h(B $B#i(B $B#j(B $B#k(B $B#l(B $B#m(B $B#n(B $B#o(B
$B#p(B $B#q(B $B#r(B $B#s(B $B#t(B $B#u(B $B#v(B $B#w(B $B#x(B $B#y(B $B#z(B
$B$!(B $B$"(B $B$#(B $B$$(B $B$%(B $B$&(B $B$'(B $B$((B $B$)(B $B$*(B $B$+(B $B$,(B $B$-(B $B$.(B $B$/(B
$B$0(B $B$1(B $B$2(B $B$3(B $B$4(B $B$5(B $B$6(B $B$7(B $B$8(B $B$9(B $B$:(B $B$;(B $B$<(B $B$=(B $B$>(B $B$?(B
$B$@(B $B$A(B $B$B(B $B$C(B $B$D(B $B$E(B $B$F(B $B$G(B $B$H(B $B$I(B $B$J(B $B$K(B $B$L(B $B$M(B $B$N(B $B$O(B
$B$P(B $B$Q(B $B$R(B $B$S(B $B$T(B $B$U(B $B$V(B $B$W(B $B$X(B $B$Y(B $B$Z(B $B$[(B $B$\(B $B$](B $B$^(B $B$_(B
$B$`(B $B$a(B $B$b(B $B$c(B $B$d(B $B$e(B $B$f(B $B$g(B $B$h(B $B$i(B $B$j(B $B$k(B $B$l(B $B$m(B $B$n(B $B$o(B
$B$p(B $B$q(B $B$r(B $B$s(B
$B%!(B $B%"(B $B%#(B $B%$(B $B%%(B $B%&(B $B%'(B $B%((B $B%)(B $B%*(B $B%+(B $B%,(B $B%-(B $B%.(B $B%/(B
$B%0(B $B%1(B $B%2(B $B%3(B $B%4(B $B%5(B $B%6(B $B%7(B $B%8(B $B%9(B $B%:(B $B%;(B $B%<(B $B%=(B $B%>(B $B%?(B
$B%@(B $B%A(B $B%B(B $B%C(B $B%D(B $B%E(B $B%F(B $B%G(B $B%H(B $B%I(B $B%J(B $B%K(B $B%L(B $B%M(B $B%N(B $B%O(B
$B%P(B $B%Q(B $B%R(B $B%S(B $B%T(B $B%U(B $B%V(B $B%W(B $B%X(B $B%Y(B $B%Z(B $B%[(B $B%\(B $B%](B $B%^(B $B%_(B
$B%`(B $B%a(B $B%b(B $B%c(B $B%d(B $B%e(B $B%f(B $B%g(B $B%h(B $B%i(B $B%j(B $B%k(B $B%l(B $B%m(B $B%n(B $B%o(B
$B%p(B $B%q(B $B%r(B $B%s(B $B%t(B $B%u(B $B%v(B
$B&!(B $B&"(B $B&#(B $B&$(B $B&%(B $B&&(B $B&'(B $B&((B $B&)(B $B&*(B $B&+(B $B&,(B $B&-(B $B&.(B $B&/(B
$B&0(B $B&1(B $B&2(B $B&3(B $B&4(B $B&5(B $B&6(B $B&7(B $B&8(B
$B&A(B $B&B(B $B&C(B $B&D(B $B&E(B $B&F(B $B&G(B $B&H(B $B&I(B $B&J(B $B&K(B $B&L(B $B&M(B $B&N(B $B&O(B
$B&P(B $B&Q(B $B&R(B $B&S(B $B&T(B $B&U(B $B&V(B $B&W(B $B&X(B
$B'!(B $B'"(B $B'#(B $B'$(B $B'%(B $B'&(B $B''(B $B'((B $B')(B $B'*(B $B'+(B $B',(B $B'-(B $B'.(B $B'/(B
$B'0(B $B'1(B $B'2(B $B'3(B $B'4(B $B'5(B $B'6(B $B'7(B $B'8(B $B'9(B $B':(B $B';(B $B'<(B $B'=(B $B'>(B $B'?(B
$B'@(B $B'A(B
$B'Q(B $B'R(B $B'S(B $B'T(B $B'U(B $B'V(B $B'W(B $B'X(B $B'Y(B $B'Z(B $B'[(B $B'\(B $B'](B $B'^(B $B'_(B
$B'`(B $B'a(B $B'b(B $B'c(B $B'd(B $B'e(B $B'f(B $B'g(B $B'h(B $B'i(B $B'j(B $B'k(B $B'l(B $B'm(B $B'n(B $B'o(B
$B'p(B $B'q(B
$B(!(B $B("(B $B(#(B $B($(B $B(%(B $B(&(B $B('(B $B(((B $B()(B $B(*(B $B(+(B $B(,(B $B(-(B $B(.(B $B(/(B
$B(0(B $B(1(B $B(2(B $B(3(B $B(4(B $B(5(B $B(6(B $B(7(B $B(8(B $B(9(B $B(:(B $B(;(B $B(<(B $B(=(B $B(>(B $B(?(B
$B(@(B
$B0!(B $B0"(B $B0#(B $B0$(B $B0%(B $B0&(B $B0'(B $B0((B $B0)(B $B0*(B $B0+(B $B0,(B $B0-(B $B0.(B $B0/(B
$B00(B $B01(B $B02(B $B03(B $B04(B $B05(B $B06(B $B07(B $B08(B $B09(B $B0:(B $B0;(B $B0<(B $B0=(B $B0>(B $B0?(B
$B0@(B $B0A(B $B0B(B $B0C(B $B0D(B $B0E(B $B0F(B $B0G(B $B0H(B $B0I(B $B0J(B $B0K(B $B0L(B $B0M(B $B0N(B $B0O(B
$B0P(B $B0Q(B $B0R(B $B0S(B $B0T(B $B0U(B $B0V(B $B0W(B $B0X(B $B0Y(B $B0Z(B $B0[(B $B0\(B $B0](B $B0^(B $B0_(B
$B0`(B $B0a(B $B0b(B $B0c(B $B0d(B $B0e(B $B0f(B $B0g(B $B0h(B $B0i(B $B0j(B $B0k(B $B0l(B $B0m(B $B0n(B $B0o(B
$B0p(B $B0q(B $B0r(B $B0s(B $B0t(B $B0u(B $B0v(B $B0w(B $B0x(B $B0y(B $B0z(B $B0{(B $B0|(B $B0}(B $B0~(B
$B1!(B $B1"(B $B1#(B $B1$(B $B1%(B $B1&(B $B1'(B $B1((B $B1)(B $B1*(B $B1+(B $B1,(B $B1-(B $B1.(B $B1/(B
$B10(B $B11(B $B12(B $B13(B $B14(B $B15(B $B16(B $B17(B $B18(B $B19(B $B1:(B $B1;(B $B1<(B $B1=(B $B1>(B $B1?(B
$B1@(B $B1A(B $B1B(B $B1C(B $B1D(B $B1E(B $B1F(B $B1G(B $B1H(B $B1I(B $B1J(B $B1K(B $B1L(B $B1M(B $B1N(B $B1O(B
$B1P(B $B1Q(B $B1R(B $B1S(B $B1T(B $B1U(B $B1V(B $B1W(B $B1X(B $B1Y(B $B1Z(B $B1[(B $B1\(B $B1](B $B1^(B $B1_(B
$B1`(B $B1a(B $B1b(B $B1c(B $B1d(B $B1e(B $B1f(B $B1g(B $B1h(B $B1i(B $B1j(B $B1k(B $B1l(B $B1m(B $B1n(B $B1o(B
$B1p(B $B1q(B $B1r(B $B1s(B $B1t(B $B1u(B $B1v(B $B1w(B $B1x(B $B1y(B $B1z(B $B1{(B $B1|(B $B1}(B $B1~(B
$B2!(B $B2"(B $B2#(B $B2$(B $B2%(B $B2&(B $B2'(B $B2((B $B2)(B $B2*(B $B2+(B $B2,(B $B2-(B $B2.(B $B2/(B
$B20(B $B21(B $B22(B $B23(B $B24(B $B25(B $B26(B $B27(B $B28(B $B29(B $B2:(B $B2;(B $B2<(B $B2=(B $B2>(B $B2?(B
$B2@(B $B2A(B $B2B(B $B2C(B $B2D(B $B2E(B $B2F(B $B2G(B $B2H(B $B2I(B $B2J(B $B2K(B $B2L(B $B2M(B $B2N(B $B2O(B
$B2P(B $B2Q(B $B2R(B $B2S(B $B2T(B $B2U(B $B2V(B $B2W(B $B2X(B $B2Y(B $B2Z(B $B2[(B $B2\(B $B2](B $B2^(B $B2_(B
$B2`(B $B2a(B $B2b(B $B2c(B $B2d(B $B2e(B $B2f(B $B2g(B $B2h(B $B2i(B $B2j(B $B2k(B $B2l(B $B2m(B $B2n(B $B2o(B
$B2p(B $B2q(B $B2r(B $B2s(B $B2t(B $B2u(B $B2v(B $B2w(B $B2x(B $B2y(B $B2z(B $B2{(B $B2|(B $B2}(B $B2~(B
$B3!(B $B3"(B $B3#(B $B3$(B $B3%(B $B3&(B $B3'(B $B3((B $B3)(B $B3*(B $B3+(B $B3,(B $B3-(B $B3.(B $B3/(B
$B30(B $B31(B $B32(B $B33(B $B34(B $B35(B $B36(B $B37(B $B38(B $B39(B $B3:(B $B3;(B $B3<(B $B3=(B $B3>(B $B3?(B
$B3@(B $B3A(B $B3B(B $B3C(B $B3D(B $B3E(B $B3F(B $B3G(B $B3H(B $B3I(B $B3J(B $B3K(B $B3L(B $B3M(B $B3N(B $B3O(B
$B3P(B $B3Q(B $B3R(B $B3S(B $B3T(B $B3U(B $B3V(B $B3W(B $B3X(B $B3Y(B $B3Z(B $B3[(B $B3\(B $B3](B $B3^(B $B3_(B
$B3`(B $B3a(B $B3b(B $B3c(B $B3d(B $B3e(B $B3f(B $B3g(B $B3h(B $B3i(B $B3j(B $B3k(B $B3l(B $B3m(B $B3n(B $B3o(B
$B3p(B $B3q(B $B3r(B $B3s(B $B3t(B $B3u(B $B3v(B $B3w(B $B3x(B $B3y(B $B3z(B $B3{(B $B3|(B $B3}(B $B3~(B
$B4!(B $B4"(B $B4#(B $B4$(B $B4%(B $B4&(B $B4'(B $B4((B $B4)(B $B4*(B $B4+(B $B4,(B $B4-(B $B4.(B $B4/(B
$B40(B $B41(B $B42(B $B43(B $B44(B $B45(B $B46(B $B47(B $B48(B $B49(B $B4:(B $B4;(B $B4<(B $B4=(B $B4>(B $B4?(B
$B4@(B $B4A(B $B4B(B $B4C(B $B4D(B $B4E(B $B4F(B $B4G(B $B4H(B $B4I(B $B4J(B $B4K(B $B4L(B $B4M(B $B4N(B $B4O(B
$B4P(B $B4Q(B $B4R(B $B4S(B $B4T(B $B4U(B $B4V(B $B4W(B $B4X(B $B4Y(B $B4Z(B $B4[(B $B4\(B $B4](B $B4^(B $B4_(B
$B4`(B $B4a(B $B4b(B $B4c(B $B4d(B $B4e(B $B4f(B $B4g(B $B4h(B $B4i(B $B4j(B $B4k(B $B4l(B $B4m(B $B4n(B $B4o(B
$B4p(B $B4q(B $B4r(B $B4s(B $B4t(B $B4u(B $B4v(B $B4w(B $B4x(B $B4y(B $B4z(B $B4{(B $B4|(B $B4}(B $B4~(B
$B5!(B $B5"(B $B5#(B $B5$(B $B5%(B $B5&(B $B5'(B $B5((B $B5)(B $B5*(B $B5+(B $B5,(B $B5-(B $B5.(B $B5/(B
$B50(B $B51(B $B52(B $B53(B $B54(B $B55(B $B56(B $B57(B $B58(B $B59(B $B5:(B $B5;(B $B5<(B $B5=(B $B5>(B $B5?(B
$B5@(B $B5A(B $B5B(B $B5C(B $B5D(B $B5E(B $B5F(B $B5G(B $B5H(B $B5I(B $B5J(B $B5K(B $B5L(B $B5M(B $B5N(B $B5O(B
$B5P(B $B5Q(B $B5R(B $B5S(B $B5T(B $B5U(B $B5V(B $B5W(B $B5X(B $B5Y(B $B5Z(B $B5[(B $B5\(B $B5](B $B5^(B $B5_(B
$B5`(B $B5a(B $B5b(B $B5c(B $B5d(B $B5e(B $B5f(B $B5g(B $B5h(B $B5i(B $B5j(B $B5k(B $B5l(B $B5m(B $B5n(B $B5o(B
$B5p(B $B5q(B $B5r(B $B5s(B $B5t(B $B5u(B $B5v(B $B5w(B $B5x(B $B5y(B $B5z(B $B5{(B $B5|(B $B5}(B $B5~(B
$B6!(B $B6"(B $B6#(B $B6$(B $B6%(B $B6&(B $B6'(B $B6((B $B6)(B $B6*(B $B6+(B $B6,(B $B6-(B $B6.(B $B6/(B
$B60(B $B61(B $B62(B $B63(B $B64(B $B65(B $B66(B $B67(B $B68(B $B69(B $B6:(B $B6;(B $B6<(B $B6=(B $B6>(B $B6?(B
$B6@(B $B6A(B $B6B(B $B6C(B $B6D(B $B6E(B $B6F(B $B6G(B $B6H(B $B6I(B $B6J(B $B6K(B $B6L(B $B6M(B $B6N(B $B6O(B
$B6P(B $B6Q(B $B6R(B $B6S(B $B6T(B $B6U(B $B6V(B $B6W(B $B6X(B $B6Y(B $B6Z(B $B6[(B $B6\(B $B6](B $B6^(B $B6_(B
$B6`(B $B6a(B $B6b(B $B6c(B $B6d(B $B6e(B $B6f(B $B6g(B $B6h(B $B6i(B $B6j(B $B6k(B $B6l(B $B6m(B $B6n(B $B6o(B
$B6p(B $B6q(B $B6r(B $B6s(B $B6t(B $B6u(B $B6v(B $B6w(B $B6x(B $B6y(B $B6z(B $B6{(B $B6|(B $B6}(B $B6~(B
$B7!(B $B7"(B $B7#(B $B7$(B $B7%(B $B7&(B $B7'(B $B7((B $B7)(B $B7*(B $B7+(B $B7,(B $B7-(B $B7.(B $B7/(B
$B70(B $B71(B $B72(B $B73(B $B74(B $B75(B $B76(B $B77(B $B78(B $B79(B $B7:(B $B7;(B $B7<(B $B7=(B $B7>(B $B7?(B
$B7@(B $B7A(B $B7B(B $B7C(B $B7D(B $B7E(B $B7F(B $B7G(B $B7H(B $B7I(B $B7J(B $B7K(B $B7L(B $B7M(B $B7N(B $B7O(B
$B7P(B $B7Q(B $B7R(B $B7S(B $B7T(B $B7U(B $B7V(B $B7W(B $B7X(B $B7Y(B $B7Z(B $B7[(B $B7\(B $B7](B $B7^(B $B7_(B
$B7`(B $B7a(B $B7b(B $B7c(B $B7d(B $B7e(B $B7f(B $B7g(B $B7h(B $B7i(B $B7j(B $B7k(B $B7l(B $B7m(B $B7n(B $B7o(B
$B7p(B $B7q(B $B7r(B $B7s(B $B7t(B $B7u(B $B7v(B $B7w(B $B7x(B $B7y(B $B7z(B $B7{(B $B7|(B $B7}(B $B7~(B
$B8!(B $B8"(B $B8#(B $B8$(B $B8%(B $B8&(B $B8'(B $B8((B $B8)(B $B8*(B $B8+(B $B8,(B $B8-(B $B8.(B $B8/(B
$B80(B $B81(B $B82(B $B83(B $B84(B $B85(B $B86(B $B87(B $B88(B $B89(B $B8:(B $B8;(B $B8<(B $B8=(B $B8>(B $B8?(B
$B8@(B $B8A(B $B8B(B $B8C(B $B8D(B $B8E(B $B8F(B $B8G(B $B8H(B $B8I(B $B8J(B $B8K(B $B8L(B $B8M(B $B8N(B $B8O(B
$B8P(B $B8Q(B $B8R(B $B8S(B $B8T(B $B8U(B $B8V(B $B8W(B $B8X(B $B8Y(B $B8Z(B $B8[(B $B8\(B $B8](B $B8^(B $B8_(B
$B8`(B $B8a(B $B8b(B $B8c(B $B8d(B $B8e(B $B8f(B $B8g(B $B8h(B $B8i(B $B8j(B $B8k(B $B8l(B $B8m(B $B8n(B $B8o(B
$B8p(B $B8q(B $B8r(B $B8s(B $B8t(B $B8u(B $B8v(B $B8w(B $B8x(B $B8y(B $B8z(B $B8{(B $B8|(B $B8}(B $B8~(B
$B9!(B $B9"(B $B9#(B $B9$(B $B9%(B $B9&(B $B9'(B $B9((B $B9)(B $B9*(B $B9+(B $B9,(B $B9-(B $B9.(B $B9/(B
$B90(B $B91(B $B92(B $B93(B $B94(B $B95(B $B96(B $B97(B $B98(B $B99(B $B9:(B $B9;(B $B9<(B $B9=(B $B9>(B $B9?(B
$B9@(B $B9A(B $B9B(B $B9C(B $B9D(B $B9E(B $B9F(B $B9G(B $B9H(B $B9I(B $B9J(B $B9K(B $B9L(B $B9M(B $B9N(B $B9O(B
$B9P(B $B9Q(B $B9R(B $B9S(B $B9T(B $B9U(B $B9V(B $B9W(B $B9X(B $B9Y(B $B9Z(B $B9[(B $B9\(B $B9](B $B9^(B $B9_(B
$B9`(B $B9a(B $B9b(B $B9c(B $B9d(B $B9e(B $B9f(B $B9g(B $B9h(B $B9i(B $B9j(B $B9k(B $B9l(B $B9m(B $B9n(B $B9o(B
$B9p(B $B9q(B $B9r(B $B9s(B $B9t(B $B9u(B $B9v(B $B9w(B $B9x(B $B9y(B $B9z(B $B9{(B $B9|(B $B9}(B $B9~(B
$B:!(B $B:"(B $B:#(B $B:$(B $B:%(B $B:&(B $B:'(B $B:((B $B:)(B $B:*(B $B:+(B $B:,(B $B:-(B $B:.(B $B:/(B
$B:0(B $B:1(B $B:2(B $B:3(B $B:4(B $B:5(B $B:6(B $B:7(B $B:8(B $B:9(B $B::(B $B:;(B $B:<(B $B:=(B $B:>(B $B:?(B
$B:@(B $B:A(B $B:B(B $B:C(B $B:D(B $B:E(B $B:F(B $B:G(B $B:H(B $B:I(B $B:J(B $B:K(B $B:L(B $B:M(B $B:N(B $B:O(B
$B:P(B $B:Q(B $B:R(B $B:S(B $B:T(B $B:U(B $B:V(B $B:W(B $B:X(B $B:Y(B $B:Z(B $B:[(B $B:\(B $B:](B $B:^(B $B:_(B
$B:`(B $B:a(B $B:b(B $B:c(B $B:d(B $B:e(B $B:f(B $B:g(B $B:h(B $B:i(B $B:j(B $B:k(B $B:l(B $B:m(B $B:n(B $B:o(B
$B:p(B $B:q(B $B:r(B $B:s(B $B:t(B $B:u(B $B:v(B $B:w(B $B:x(B $B:y(B $B:z(B $B:{(B $B:|(B $B:}(B $B:~(B
$B;!(B $B;"(B $B;#(B $B;$(B $B;%(B $B;&(B $B;'(B $B;((B $B;)(B $B;*(B $B;+(B $B;,(B $B;-(B $B;.(B $B;/(B
$B;0(B $B;1(B $B;2(B $B;3(B $B;4(B $B;5(B $B;6(B $B;7(B $B;8(B $B;9(B $B;:(B $B;;(B $B;<(B $B;=(B $B;>(B $B;?(B
$B;@(B $B;A(B $B;B(B $B;C(B $B;D(B $B;E(B $B;F(B $B;G(B $B;H(B $B;I(B $B;J(B $B;K(B $B;L(B $B;M(B $B;N(B $B;O(B
$B;P(B $B;Q(B $B;R(B $B;S(B $B;T(B $B;U(B $B;V(B $B;W(B $B;X(B $B;Y(B $B;Z(B $B;[(B $B;\(B $B;](B $B;^(B $B;_(B
$B;`(B $B;a(B $B;b(B $B;c(B $B;d(B $B;e(B $B;f(B $B;g(B $B;h(B $B;i(B $B;j(B $B;k(B $B;l(B $B;m(B $B;n(B $B;o(B
$B;p(B $B;q(B $B;r(B $B;s(B $B;t(B $B;u(B $B;v(B $B;w(B $B;x(B $B;y(B $B;z(B $B;{(B $B;|(B $B;}(B $B;~(B
$B<!(B $B<"(B $B<#(B $B<$(B $B<%(B $B<&(B $B<'(B $B<((B $B<)(B $B<*(B $B<+(B $B<,(B $B<-(B $B<.(B $B</(B
$B<0(B $B<1(B $B<2(B $B<3(B $B<4(B $B<5(B $B<6(B $B<7(B $B<8(B $B<9(B $B<:(B $B<;(B $B<<(B $B<=(B $B<>(B $B<?(B
$B<@(B $B<A(B $B<B(B $B<C(B $B<D(B $B<E(B $B<F(B $B<G(B $B<H(B $B<I(B $B<J(B $B<K(B $B<L(B $B<M(B $B<N(B $B<O(B
$B<P(B $B<Q(B $B<R(B $B<S(B $B<T(B $B<U(B $B<V(B $B<W(B $B<X(B $B<Y(B $B<Z(B $B<[(B $B<\(B $B<](B $B<^(B $B<_(B
$B<`(B $B<a(B $B<b(B $B<c(B $B<d(B $B<e(B $B<f(B $B<g(B $B<h(B $B<i(B $B<j(B $B<k(B $B<l(B $B<m(B $B<n(B $B<o(B
$B<p(B $B<q(B $B<r(B $B<s(B $B<t(B $B<u(B $B<v(B $B<w(B $B<x(B $B<y(B $B<z(B $B<{(B $B<|(B $B<}(B $B<~(B
$B=!(B $B="(B $B=#(B $B=$(B $B=%(B $B=&(B $B='(B $B=((B $B=)(B $B=*(B $B=+(B $B=,(B $B=-(B $B=.(B $B=/(B
$B=0(B $B=1(B $B=2(B $B=3(B $B=4(B $B=5(B $B=6(B $B=7(B $B=8(B $B=9(B $B=:(B $B=;(B $B=<(B $B==(B $B=>(B $B=?(B
$B=@(B $B=A(B $B=B(B $B=C(B $B=D(B $B=E(B $B=F(B $B=G(B $B=H(B $B=I(B $B=J(B $B=K(B $B=L(B $B=M(B $B=N(B $B=O(B
$B=P(B $B=Q(B $B=R(B $B=S(B $B=T(B $B=U(B $B=V(B $B=W(B $B=X(B $B=Y(B $B=Z(B $B=[(B $B=\(B $B=](B $B=^(B $B=_(B
$B=`(B $B=a(B $B=b(B $B=c(B $B=d(B $B=e(B $B=f(B $B=g(B $B=h(B $B=i(B $B=j(B $B=k(B $B=l(B $B=m(B $B=n(B $B=o(B
$B=p(B $B=q(B $B=r(B $B=s(B $B=t(B $B=u(B $B=v(B $B=w(B $B=x(B $B=y(B $B=z(B $B={(B $B=|(B $B=}(B $B=~(B
$B>!(B $B>"(B $B>#(B $B>$(B $B>%(B $B>&(B $B>'(B $B>((B $B>)(B $B>*(B $B>+(B $B>,(B $B>-(B $B>.(B $B>/(B
$B>0(B $B>1(B $B>2(B $B>3(B $B>4(B $B>5(B $B>6(B $B>7(B $B>8(B $B>9(B $B>:(B $B>;(B $B><(B $B>=(B $B>>(B $B>?(B
$B>@(B $B>A(B $B>B(B $B>C(B $B>D(B $B>E(B $B>F(B $B>G(B $B>H(B $B>I(B $B>J(B $B>K(B $B>L(B $B>M(B $B>N(B $B>O(B
$B>P(B $B>Q(B $B>R(B $B>S(B $B>T(B $B>U(B $B>V(B $B>W(B $B>X(B $B>Y(B $B>Z(B $B>[(B $B>\(B $B>](B $B>^(B $B>_(B
$B>`(B $B>a(B $B>b(B $B>c(B $B>d(B $B>e(B $B>f(B $B>g(B $B>h(B $B>i(B $B>j(B $B>k(B $B>l(B $B>m(B $B>n(B $B>o(B
$B>p(B $B>q(B $B>r(B $B>s(B $B>t(B $B>u(B $B>v(B $B>w(B $B>x(B $B>y(B $B>z(B $B>{(B $B>|(B $B>}(B $B>~(B
$B?!(B $B?"(B $B?#(B $B?$(B $B?%(B $B?&(B $B?'(B $B?((B $B?)(B $B?*(B $B?+(B $B?,(B $B?-(B $B?.(B $B?/(B
$B?0(B $B?1(B $B?2(B $B?3(B $B?4(B $B?5(B $B?6(B $B?7(B $B?8(B $B?9(B $B?:(B $B?;(B $B?<(B $B?=(B $B?>(B $B??(B
$B?@(B $B?A(B $B?B(B $B?C(B $B?D(B $B?E(B $B?F(B $B?G(B $B?H(B $B?I(B $B?J(B $B?K(B $B?L(B $B?M(B $B?N(B $B?O(B
$B?P(B $B?Q(B $B?R(B $B?S(B $B?T(B $B?U(B $B?V(B $B?W(B $B?X(B $B?Y(B $B?Z(B $B?[(B $B?\(B $B?](B $B?^(B $B?_(B
$B?`(B $B?a(B $B?b(B $B?c(B $B?d(B $B?e(B $B?f(B $B?g(B $B?h(B $B?i(B $B?j(B $B?k(B $B?l(B $B?m(B $B?n(B $B?o(B
$B?p(B $B?q(B $B?r(B $B?s(B $B?t(B $B?u(B $B?v(B $B?w(B $B?x(B $B?y(B $B?z(B $B?{(B $B?|(B $B?}(B $B?~(B
$B@!(B $B@"(B $B@#(B $B@$(B $B@%(B $B@&(B $B@'(B $B@((B $B@)(B $B@*(B $B@+(B $B@,(B $B@-(B $B@.(B $B@/(B
$B@0(B $B@1(B $B@2(B $B@3(B $B@4(B $B@5(B $B@6(B $B@7(B $B@8(B $B@9(B $B@:(B $B@;(B $B@<(B $B@=(B $B@>(B $B@?(B
$B@@(B $B@A(B $B@B(B $B@C(B $B@D(B $B@E(B $B@F(B $B@G(B $B@H(B $B@I(B $B@J(B $B@K(B $B@L(B $B@M(B $B@N(B $B@O(B
$B@P(B $B@Q(B $B@R(B $B@S(B $B@T(B $B@U(B $B@V(B $B@W(B $B@X(B $B@Y(B $B@Z(B $B@[(B $B@\(B $B@](B $B@^(B $B@_(B
$B@`(B $B@a(B $B@b(B $B@c(B $B@d(B $B@e(B $B@f(B $B@g(B $B@h(B $B@i(B $B@j(B $B@k(B $B@l(B $B@m(B $B@n(B $B@o(B
$B@p(B $B@q(B $B@r(B $B@s(B $B@t(B $B@u(B $B@v(B $B@w(B $B@x(B $B@y(B $B@z(B $B@{(B $B@|(B $B@}(B $B@~(B
$BA!(B $BA"(B $BA#(B $BA$(B $BA%(B $BA&(B $BA'(B $BA((B $BA)(B $BA*(B $BA+(B $BA,(B $BA-(B $BA.(B $BA/(B
$BA0(B $BA1(B $BA2(B $BA3(B $BA4(B $BA5(B $BA6(B $BA7(B $BA8(B $BA9(B $BA:(B $BA;(B $BA<(B $BA=(B $BA>(B $BA?(B
$BA@(B $BAA(B $BAB(B $BAC(B $BAD(B $BAE(B $BAF(B $BAG(B $BAH(B $BAI(B $BAJ(B $BAK(B $BAL(B $BAM(B $BAN(B $BAO(B
$BAP(B $BAQ(B $BAR(B $BAS(B $BAT(B $BAU(B $BAV(B $BAW(B $BAX(B $BAY(B $BAZ(B $BA[(B $BA\(B $BA](B $BA^(B $BA_(B
$BA`(B $BAa(B $BAb(B $BAc(B $BAd(B $BAe(B $BAf(B $BAg(B $BAh(B $BAi(B $BAj(B $BAk(B $BAl(B $BAm(B $BAn(B $BAo(B
$BAp(B $BAq(B $BAr(B $BAs(B $BAt(B $BAu(B $BAv(B $BAw(B $BAx(B $BAy(B $BAz(B $BA{(B $BA|(B $BA}(B $BA~(B
$BB!(B $BB"(B $BB#(B $BB$(B $BB%(B $BB&(B $BB'(B $BB((B $BB)(B $BB*(B $BB+(B $BB,(B $BB-(B $BB.(B $BB/(B
$BB0(B $BB1(B $BB2(B $BB3(B $BB4(B $BB5(B $BB6(B $BB7(B $BB8(B $BB9(B $BB:(B $BB;(B $BB<(B $BB=(B $BB>(B $BB?(B
$BB@(B $BBA(B $BBB(B $BBC(B $BBD(B $BBE(B $BBF(B $BBG(B $BBH(B $BBI(B $BBJ(B $BBK(B $BBL(B $BBM(B $BBN(B $BBO(B
$BBP(B $BBQ(B $BBR(B $BBS(B $BBT(B $BBU(B $BBV(B $BBW(B $BBX(B $BBY(B $BBZ(B $BB[(B $BB\(B $BB](B $BB^(B $BB_(B
$BB`(B $BBa(B $BBb(B $BBc(B $BBd(B $BBe(B $BBf(B $BBg(B $BBh(B $BBi(B $BBj(B $BBk(B $BBl(B $BBm(B $BBn(B $BBo(B
$BBp(B $BBq(B $BBr(B $BBs(B $BBt(B $BBu(B $BBv(B $BBw(B $BBx(B $BBy(B $BBz(B $BB{(B $BB|(B $BB}(B $BB~(B
$BC!(B $BC"(B $BC#(B $BC$(B $BC%(B $BC&(B $BC'(B $BC((B $BC)(B $BC*(B $BC+(B $BC,(B $BC-(B $BC.(B $BC/(B
$BC0(B $BC1(B $BC2(B $BC3(B $BC4(B $BC5(B $BC6(B $BC7(B $BC8(B $BC9(B $BC:(B $BC;(B $BC<(B $BC=(B $BC>(B $BC?(B
$BC@(B $BCA(B $BCB(B $BCC(B $BCD(B $BCE(B $BCF(B $BCG(B $BCH(B $BCI(B $BCJ(B $BCK(B $BCL(B $BCM(B $BCN(B $BCO(B
$BCP(B $BCQ(B $BCR(B $BCS(B $BCT(B $BCU(B $BCV(B $BCW(B $BCX(B $BCY(B $BCZ(B $BC[(B $BC\(B $BC](B $BC^(B $BC_(B
$BC`(B $BCa(B $BCb(B $BCc(B $BCd(B $BCe(B $BCf(B $BCg(B $BCh(B $BCi(B $BCj(B $BCk(B $BCl(B $BCm(B $BCn(B $BCo(B
$BCp(B $BCq(B $BCr(B $BCs(B $BCt(B $BCu(B $BCv(B $BCw(B $BCx(B $BCy(B $BCz(B $BC{(B $BC|(B $BC}(B $BC~(B
$BD!(B $BD"(B $BD#(B $BD$(B $BD%(B $BD&(B $BD'(B $BD((B $BD)(B $BD*(B $BD+(B $BD,(B $BD-(B $BD.(B $BD/(B
$BD0(B $BD1(B $BD2(B $BD3(B $BD4(B $BD5(B $BD6(B $BD7(B $BD8(B $BD9(B $BD:(B $BD;(B $BD<(B $BD=(B $BD>(B $BD?(B
$BD@(B $BDA(B $BDB(B $BDC(B $BDD(B $BDE(B $BDF(B $BDG(B $BDH(B $BDI(B $BDJ(B $BDK(B $BDL(B $BDM(B $BDN(B $BDO(B
$BDP(B $BDQ(B $BDR(B $BDS(B $BDT(B $BDU(B $BDV(B $BDW(B $BDX(B $BDY(B $BDZ(B $BD[(B $BD\(B $BD](B $BD^(B $BD_(B
$BD`(B $BDa(B $BDb(B $BDc(B $BDd(B $BDe(B $BDf(B $BDg(B $BDh(B $BDi(B $BDj(B $BDk(B $BDl(B $BDm(B $BDn(B $BDo(B
$BDp(B $BDq(B $BDr(B $BDs(B $BDt(B $BDu(B $BDv(B $BDw(B $BDx(B $BDy(B $BDz(B $BD{(B $BD|(B $BD}(B $BD~(B
$BE!(B $BE"(B $BE#(B $BE$(B $BE%(B $BE&(B $BE'(B $BE((B $BE)(B $BE*(B $BE+(B $BE,(B $BE-(B $BE.(B $BE/(B
$BE0(B $BE1(B $BE2(B $BE3(B $BE4(B $BE5(B $BE6(B $BE7(B $BE8(B $BE9(B $BE:(B $BE;(B $BE<(B $BE=(B $BE>(B $BE?(B
$BE@(B $BEA(B $BEB(B $BEC(B $BED(B $BEE(B $BEF(B $BEG(B $BEH(B $BEI(B $BEJ(B $BEK(B $BEL(B $BEM(B $BEN(B $BEO(B
$BEP(B $BEQ(B $BER(B $BES(B $BET(B $BEU(B $BEV(B $BEW(B $BEX(B $BEY(B $BEZ(B $BE[(B $BE\(B $BE](B $BE^(B $BE_(B
$BE`(B $BEa(B $BEb(B $BEc(B $BEd(B $BEe(B $BEf(B $BEg(B $BEh(B $BEi(B $BEj(B $BEk(B $BEl(B $BEm(B $BEn(B $BEo(B
$BEp(B $BEq(B $BEr(B $BEs(B $BEt(B $BEu(B $BEv(B $BEw(B $BEx(B $BEy(B $BEz(B $BE{(B $BE|(B $BE}(B $BE~(B
$BF!(B $BF"(B $BF#(B $BF$(B $BF%(B $BF&(B $BF'(B $BF((B $BF)(B $BF*(B $BF+(B $BF,(B $BF-(B $BF.(B $BF/(B
$BF0(B $BF1(B $BF2(B $BF3(B $BF4(B $BF5(B $BF6(B $BF7(B $BF8(B $BF9(B $BF:(B $BF;(B $BF<(B $BF=(B $BF>(B $BF?(B
$BF@(B $BFA(B $BFB(B $BFC(B $BFD(B $BFE(B $BFF(B $BFG(B $BFH(B $BFI(B $BFJ(B $BFK(B $BFL(B $BFM(B $BFN(B $BFO(B
$BFP(B $BFQ(B $BFR(B $BFS(B $BFT(B $BFU(B $BFV(B $BFW(B $BFX(B $BFY(B $BFZ(B $BF[(B $BF\(B $BF](B $BF^(B $BF_(B
$BF`(B $BFa(B $BFb(B $BFc(B $BFd(B $BFe(B $BFf(B $BFg(B $BFh(B $BFi(B $BFj(B $BFk(B $BFl(B $BFm(B $BFn(B $BFo(B
$BFp(B $BFq(B $BFr(B $BFs(B $BFt(B $BFu(B $BFv(B $BFw(B $BFx(B $BFy(B $BFz(B $BF{(B $BF|(B $BF}(B $BF~(B
$BG!(B $BG"(B $BG#(B $BG$(B $BG%(B $BG&(B $BG'(B $BG((B $BG)(B $BG*(B $BG+(B $BG,(B $BG-(B $BG.(B $BG/(B
$BG0(B $BG1(B $BG2(B $BG3(B $BG4(B $BG5(B $BG6(B $BG7(B $BG8(B $BG9(B $BG:(B $BG;(B $BG<(B $BG=(B $BG>(B $BG?(B
$BG@(B $BGA(B $BGB(B $BGC(B $BGD(B $BGE(B $BGF(B $BGG(B $BGH(B $BGI(B $BGJ(B $BGK(B $BGL(B $BGM(B $BGN(B $BGO(B
$BGP(B $BGQ(B $BGR(B $BGS(B $BGT(B $BGU(B $BGV(B $BGW(B $BGX(B $BGY(B $BGZ(B $BG[(B $BG\(B $BG](B $BG^(B $BG_(B
$BG`(B $BGa(B $BGb(B $BGc(B $BGd(B $BGe(B $BGf(B $BGg(B $BGh(B $BGi(B $BGj(B $BGk(B $BGl(B $BGm(B $BGn(B $BGo(B
$BGp(B $BGq(B $BGr(B $BGs(B $BGt(B $BGu(B $BGv(B $BGw(B $BGx(B $BGy(B $BGz(B $BG{(B $BG|(B $BG}(B $BG~(B
$BH!(B $BH"(B $BH#(B $BH$(B $BH%(B $BH&(B $BH'(B $BH((B $BH)(B $BH*(B $BH+(B $BH,(B $BH-(B $BH.(B $BH/(B
$BH0(B $BH1(B $BH2(B $BH3(B $BH4(B $BH5(B $BH6(B $BH7(B $BH8(B $BH9(B $BH:(B $BH;(B $BH<(B $BH=(B $BH>(B $BH?(B
$BH@(B $BHA(B $BHB(B $BHC(B $BHD(B $BHE(B $BHF(B $BHG(B $BHH(B $BHI(B $BHJ(B $BHK(B $BHL(B $BHM(B $BHN(B $BHO(B
$BHP(B $BHQ(B $BHR(B $BHS(B $BHT(B $BHU(B $BHV(B $BHW(B $BHX(B $BHY(B $BHZ(B $BH[(B $BH\(B $BH](B $BH^(B $BH_(B
$BH`(B $BHa(B $BHb(B $BHc(B $BHd(B $BHe(B $BHf(B $BHg(B $BHh(B $BHi(B $BHj(B $BHk(B $BHl(B $BHm(B $BHn(B $BHo(B
$BHp(B $BHq(B $BHr(B $BHs(B $BHt(B $BHu(B $BHv(B $BHw(B $BHx(B $BHy(B $BHz(B $BH{(B $BH|(B $BH}(B $BH~(B
$BI!(B $BI"(B $BI#(B $BI$(B $BI%(B $BI&(B $BI'(B $BI((B $BI)(B $BI*(B $BI+(B $BI,(B $BI-(B $BI.(B $BI/(B
$BI0(B $BI1(B $BI2(B $BI3(B $BI4(B $BI5(B $BI6(B $BI7(B $BI8(B $BI9(B $BI:(B $BI;(B $BI<(B $BI=(B $BI>(B $BI?(B
$BI@(B $BIA(B $BIB(B $BIC(B $BID(B $BIE(B $BIF(B $BIG(B $BIH(B $BII(B $BIJ(B $BIK(B $BIL(B $BIM(B $BIN(B $BIO(B
$BIP(B $BIQ(B $BIR(B $BIS(B $BIT(B $BIU(B $BIV(B $BIW(B $BIX(B $BIY(B $BIZ(B $BI[(B $BI\(B $BI](B $BI^(B $BI_(B
$BI`(B $BIa(B $BIb(B $BIc(B $BId(B $BIe(B $BIf(B $BIg(B $BIh(B $BIi(B $BIj(B $BIk(B $BIl(B $BIm(B $BIn(B $BIo(B
$BIp(B $BIq(B $BIr(B $BIs(B $BIt(B $BIu(B $BIv(B $BIw(B $BIx(B $BIy(B $BIz(B $BI{(B $BI|(B $BI}(B $BI~(B
$BJ!(B $BJ"(B $BJ#(B $BJ$(B $BJ%(B $BJ&(B $BJ'(B $BJ((B $BJ)(B $BJ*(B $BJ+(B $BJ,(B $BJ-(B $BJ.(B $BJ/(B
$BJ0(B $BJ1(B $BJ2(B $BJ3(B $BJ4(B $BJ5(B $BJ6(B $BJ7(B $BJ8(B $BJ9(B $BJ:(B $BJ;(B $BJ<(B $BJ=(B $BJ>(B $BJ?(B
$BJ@(B $BJA(B $BJB(B $BJC(B $BJD(B $BJE(B $BJF(B $BJG(B $BJH(B $BJI(B $BJJ(B $BJK(B $BJL(B $BJM(B $BJN(B $BJO(B
$BJP(B $BJQ(B $BJR(B $BJS(B $BJT(B $BJU(B $BJV(B $BJW(B $BJX(B $BJY(B $BJZ(B $BJ[(B $BJ\(B $BJ](B $BJ^(B $BJ_(B
$BJ`(B $BJa(B $BJb(B $BJc(B $BJd(B $BJe(B $BJf(B $BJg(B $BJh(B $BJi(B $BJj(B $BJk(B $BJl(B $BJm(B $BJn(B $BJo(B
$BJp(B $BJq(B $BJr(B $BJs(B $BJt(B $BJu(B $BJv(B $BJw(B $BJx(B $BJy(B $BJz(B $BJ{(B $BJ|(B $BJ}(B $BJ~(B
$BK!(B $BK"(B $BK#(B $BK$(B $BK%(B $BK&(B $BK'(B $BK((B $BK)(B $BK*(B $BK+(B $BK,(B $BK-(B $BK.(B $BK/(B
$BK0(B $BK1(B $BK2(B $BK3(B $BK4(B $BK5(B $BK6(B $BK7(B $BK8(B $BK9(B $BK:(B $BK;(B $BK<(B $BK=(B $BK>(B $BK?(B
$BK@(B $BKA(B $BKB(B $BKC(B $BKD(B $BKE(B $BKF(B $BKG(B $BKH(B $BKI(B $BKJ(B $BKK(B $BKL(B $BKM(B $BKN(B $BKO(B
$BKP(B $BKQ(B $BKR(B $BKS(B $BKT(B $BKU(B $BKV(B $BKW(B $BKX(B $BKY(B $BKZ(B $BK[(B $BK\(B $BK](B $BK^(B $BK_(B
$BK`(B $BKa(B $BKb(B $BKc(B $BKd(B $BKe(B $BKf(B $BKg(B $BKh(B $BKi(B $BKj(B $BKk(B $BKl(B $BKm(B $BKn(B $BKo(B
$BKp(B $BKq(B $BKr(B $BKs(B $BKt(B $BKu(B $BKv(B $BKw(B $BKx(B $BKy(B $BKz(B $BK{(B $BK|(B $BK}(B $BK~(B
$BL!(B $BL"(B $BL#(B $BL$(B $BL%(B $BL&(B $BL'(B $BL((B $BL)(B $BL*(B $BL+(B $BL,(B $BL-(B $BL.(B $BL/(B
$BL0(B $BL1(B $BL2(B $BL3(B $BL4(B $BL5(B $BL6(B $BL7(B $BL8(B $BL9(B $BL:(B $BL;(B $BL<(B $BL=(B $BL>(B $BL?(B
$BL@(B $BLA(B $BLB(B $BLC(B $BLD(B $BLE(B $BLF(B $BLG(B $BLH(B $BLI(B $BLJ(B $BLK(B $BLL(B $BLM(B $BLN(B $BLO(B
$BLP(B $BLQ(B $BLR(B $BLS(B $BLT(B $BLU(B $BLV(B $BLW(B $BLX(B $BLY(B $BLZ(B $BL[(B $BL\(B $BL](B $BL^(B $BL_(B
$BL`(B $BLa(B $BLb(B $BLc(B $BLd(B $BLe(B $BLf(B $BLg(B $BLh(B $BLi(B $BLj(B $BLk(B $BLl(B $BLm(B $BLn(B $BLo(B
$BLp(B $BLq(B $BLr(B $BLs(B $BLt(B $BLu(B $BLv(B $BLw(B $BLx(B $BLy(B $BLz(B $BL{(B $BL|(B $BL}(B $BL~(B
$BM!(B $BM"(B $BM#(B $BM$(B $BM%(B $BM&(B $BM'(B $BM((B $BM)(B $BM*(B $BM+(B $BM,(B $BM-(B $BM.(B $BM/(B
$BM0(B $BM1(B $BM2(B $BM3(B $BM4(B $BM5(B $BM6(B $BM7(B $BM8(B $BM9(B $BM:(B $BM;(B $BM<(B $BM=(B $BM>(B $BM?(B
$BM@(B $BMA(B $BMB(B $BMC(B $BMD(B $BME(B $BMF(B $BMG(B $BMH(B $BMI(B $BMJ(B $BMK(B $BML(B $BMM(B $BMN(B $BMO(B
$BMP(B $BMQ(B $BMR(B $BMS(B $BMT(B $BMU(B $BMV(B $BMW(B $BMX(B $BMY(B $BMZ(B $BM[(B $BM\(B $BM](B $BM^(B $BM_(B
$BM`(B $BMa(B $BMb(B $BMc(B $BMd(B $BMe(B $BMf(B $BMg(B $BMh(B $BMi(B $BMj(B $BMk(B $BMl(B $BMm(B $BMn(B $BMo(B
$BMp(B $BMq(B $BMr(B $BMs(B $BMt(B $BMu(B $BMv(B $BMw(B $BMx(B $BMy(B $BMz(B $BM{(B $BM|(B $BM}(B $BM~(B
$BN!(B $BN"(B $BN#(B $BN$(B $BN%(B $BN&(B $BN'(B $BN((B $BN)(B $BN*(B $BN+(B $BN,(B $BN-(B $BN.(B $BN/(B
$BN0(B $BN1(B $BN2(B $BN3(B $BN4(B $BN5(B $BN6(B $BN7(B $BN8(B $BN9(B $BN:(B $BN;(B $BN<(B $BN=(B $BN>(B $BN?(B
$BN@(B $BNA(B $BNB(B $BNC(B $BND(B $BNE(B $BNF(B $BNG(B $BNH(B $BNI(B $BNJ(B $BNK(B $BNL(B $BNM(B $BNN(B $BNO(B
$BNP(B $BNQ(B $BNR(B $BNS(B $BNT(B $BNU(B $BNV(B $BNW(B $BNX(B $BNY(B $BNZ(B $BN[(B $BN\(B $BN](B $BN^(B $BN_(B
$BN`(B $BNa(B $BNb(B $BNc(B $BNd(B $BNe(B $BNf(B $BNg(B $BNh(B $BNi(B $BNj(B $BNk(B $BNl(B $BNm(B $BNn(B $BNo(B
$BNp(B $BNq(B $BNr(B $BNs(B $BNt(B $BNu(B $BNv(B $BNw(B $BNx(B $BNy(B $BNz(B $BN{(B $BN|(B $BN}(B $BN~(B
$BO!(B $BO"(B $BO#(B $BO$(B $BO%(B $BO&(B $BO'(B $BO((B $BO)(B $BO*(B $BO+(B $BO,(B $BO-(B $BO.(B $BO/(B
$BO0(B $BO1(B $BO2(B $BO3(B $BO4(B $BO5(B $BO6(B $BO7(B $BO8(B $BO9(B $BO:(B $BO;(B $BO<(B $BO=(B $BO>(B $BO?(B
$BO@(B $BOA(B $BOB(B $BOC(B $BOD(B $BOE(B $BOF(B $BOG(B $BOH(B $BOI(B $BOJ(B $BOK(B $BOL(B $BOM(B $BON(B $BOO(B
$BOP(B $BOQ(B $BOR(B $BOS(B
$BP!(B $BP"(B $BP#(B $BP$(B $BP%(B $BP&(B $BP'(B $BP((B $BP)(B $BP*(B $BP+(B $BP,(B $BP-(B $BP.(B $BP/(B
$BP0(B $BP1(B $BP2(B $BP3(B $BP4(B $BP5(B $BP6(B $BP7(B $BP8(B $BP9(B $BP:(B $BP;(B $BP<(B $BP=(B $BP>(B $BP?(B
$BP@(B $BPA(B $BPB(B $BPC(B $BPD(B $BPE(B $BPF(B $BPG(B $BPH(B $BPI(B $BPJ(B $BPK(B $BPL(B $BPM(B $BPN(B $BPO(B
$BPP(B $BPQ(B $BPR(B $BPS(B $BPT(B $BPU(B $BPV(B $BPW(B $BPX(B $BPY(B $BPZ(B $BP[(B $BP\(B $BP](B $BP^(B $BP_(B
$BP`(B $BPa(B $BPb(B $BPc(B $BPd(B $BPe(B $BPf(B $BPg(B $BPh(B $BPi(B $BPj(B $BPk(B $BPl(B $BPm(B $BPn(B $BPo(B
$BPp(B $BPq(B $BPr(B $BPs(B $BPt(B $BPu(B $BPv(B $BPw(B $BPx(B $BPy(B $BPz(B $BP{(B $BP|(B $BP}(B $BP~(B
$BQ!(B $BQ"(B $BQ#(B $BQ$(B $BQ%(B $BQ&(B $BQ'(B $BQ((B $BQ)(B $BQ*(B $BQ+(B $BQ,(B $BQ-(B $BQ.(B $BQ/(B
$BQ0(B $BQ1(B $BQ2(B $BQ3(B $BQ4(B $BQ5(B $BQ6(B $BQ7(B $BQ8(B $BQ9(B $BQ:(B $BQ;(B $BQ<(B $BQ=(B $BQ>(B $BQ?(B
$BQ@(B $BQA(B $BQB(B $BQC(B $BQD(B $BQE(B $BQF(B $BQG(B $BQH(B $BQI(B $BQJ(B $BQK(B $BQL(B $BQM(B $BQN(B $BQO(B
$BQP(B $BQQ(B $BQR(B $BQS(B $BQT(B $BQU(B $BQV(B $BQW(B $BQX(B $BQY(B $BQZ(B $BQ[(B $BQ\(B $BQ](B $BQ^(B $BQ_(B
$BQ`(B $BQa(B $BQb(B $BQc(B $BQd(B $BQe(B $BQf(B $BQg(B $BQh(B $BQi(B $BQj(B $BQk(B $BQl(B $BQm(B $BQn(B $BQo(B
$BQp(B $BQq(B $BQr(B $BQs(B $BQt(B $BQu(B $BQv(B $BQw(B $BQx(B $BQy(B $BQz(B $BQ{(B $BQ|(B $BQ}(B $BQ~(B
$BR!(B $BR"(B $BR#(B $BR$(B $BR%(B $BR&(B $BR'(B $BR((B $BR)(B $BR*(B $BR+(B $BR,(B $BR-(B $BR.(B $BR/(B
$BR0(B $BR1(B $BR2(B $BR3(B $BR4(B $BR5(B $BR6(B $BR7(B $BR8(B $BR9(B $BR:(B $BR;(B $BR<(B $BR=(B $BR>(B $BR?(B
$BR@(B $BRA(B $BRB(B $BRC(B $BRD(B $BRE(B $BRF(B $BRG(B $BRH(B $BRI(B $BRJ(B $BRK(B $BRL(B $BRM(B $BRN(B $BRO(B
$BRP(B $BRQ(B $BRR(B $BRS(B $BRT(B $BRU(B $BRV(B $BRW(B $BRX(B $BRY(B $BRZ(B $BR[(B $BR\(B $BR](B $BR^(B $BR_(B
$BR`(B $BRa(B $BRb(B $BRc(B $BRd(B $BRe(B $BRf(B $BRg(B $BRh(B $BRi(B $BRj(B $BRk(B $BRl(B $BRm(B $BRn(B $BRo(B
$BRp(B $BRq(B $BRr(B $BRs(B $BRt(B $BRu(B $BRv(B $BRw(B $BRx(B $BRy(B $BRz(B $BR{(B $BR|(B $BR}(B $BR~(B
$BS!(B $BS"(B $BS#(B $BS$(B $BS%(B $BS&(B $BS'(B $BS((B $BS)(B $BS*(B $BS+(B $BS,(B $BS-(B $BS.(B $BS/(B
$BS0(B $BS1(B $BS2(B $BS3(B $BS4(B $BS5(B $BS6(B $BS7(B $BS8(B $BS9(B $BS:(B $BS;(B $BS<(B $BS=(B $BS>(B $BS?(B
$BS@(B $BSA(B $BSB(B $BSC(B $BSD(B $BSE(B $BSF(B $BSG(B $BSH(B $BSI(B $BSJ(B $BSK(B $BSL(B $BSM(B $BSN(B $BSO(B
$BSP(B $BSQ(B $BSR(B $BSS(B $BST(B $BSU(B $BSV(B $BSW(B $BSX(B $BSY(B $BSZ(B $BS[(B $BS\(B $BS](B $BS^(B $BS_(B
$BS`(B $BSa(B $BSb(B $BSc(B $BSd(B $BSe(B $BSf(B $BSg(B $BSh(B $BSi(B $BSj(B $BSk(B $BSl(B $BSm(B $BSn(B $BSo(B
$BSp(B $BSq(B $BSr(B $BSs(B $BSt(B $BSu(B $BSv(B $BSw(B $BSx(B $BSy(B $BSz(B $BS{(B $BS|(B $BS}(B $BS~(B
$BT!(B $BT"(B $BT#(B $BT$(B $BT%(B $BT&(B $BT'(B $BT((B $BT)(B $BT*(B $BT+(B $BT,(B $BT-(B $BT.(B $BT/(B
$BT0(B $BT1(B $BT2(B $BT3(B $BT4(B $BT5(B $BT6(B $BT7(B $BT8(B $BT9(B $BT:(B $BT;(B $BT<(B $BT=(B $BT>(B $BT?(B
$BT@(B $BTA(B $BTB(B $BTC(B $BTD(B $BTE(B $BTF(B $BTG(B $BTH(B $BTI(B $BTJ(B $BTK(B $BTL(B $BTM(B $BTN(B $BTO(B
$BTP(B $BTQ(B $BTR(B $BTS(B $BTT(B $BTU(B $BTV(B $BTW(B $BTX(B $BTY(B $BTZ(B $BT[(B $BT\(B $BT](B $BT^(B $BT_(B
$BT`(B $BTa(B $BTb(B $BTc(B $BTd(B $BTe(B $BTf(B $BTg(B $BTh(B $BTi(B $BTj(B $BTk(B $BTl(B $BTm(B $BTn(B $BTo(B
$BTp(B $BTq(B $BTr(B $BTs(B $BTt(B $BTu(B $BTv(B $BTw(B $BTx(B $BTy(B $BTz(B $BT{(B $BT|(B $BT}(B $BT~(B
$BU!(B $BU"(B $BU#(B $BU$(B $BU%(B $BU&(B $BU'(B $BU((B $BU)(B $BU*(B $BU+(B $BU,(B $BU-(B $BU.(B $BU/(B
$BU0(B $BU1(B $BU2(B $BU3(B $BU4(B $BU5(B $BU6(B $BU7(B $BU8(B $BU9(B $BU:(B $BU;(B $BU<(B $BU=(B $BU>(B $BU?(B
$BU@(B $BUA(B $BUB(B $BUC(B $BUD(B $BUE(B $BUF(B $BUG(B $BUH(B $BUI(B $BUJ(B $BUK(B $BUL(B $BUM(B $BUN(B $BUO(B
$BUP(B $BUQ(B $BUR(B $BUS(B $BUT(B $BUU(B $BUV(B $BUW(B $BUX(B $BUY(B $BUZ(B $BU[(B $BU\(B $BU](B $BU^(B $BU_(B
$BU`(B $BUa(B $BUb(B $BUc(B $BUd(B $BUe(B $BUf(B $BUg(B $BUh(B $BUi(B $BUj(B $BUk(B $BUl(B $BUm(B $BUn(B $BUo(B
$BUp(B $BUq(B $BUr(B $BUs(B $BUt(B $BUu(B $BUv(B $BUw(B $BUx(B $BUy(B $BUz(B $BU{(B $BU|(B $BU}(B $BU~(B
$BV!(B $BV"(B $BV#(B $BV$(B $BV%(B $BV&(B $BV'(B $BV((B $BV)(B $BV*(B $BV+(B $BV,(B $BV-(B $BV.(B $BV/(B
$BV0(B $BV1(B $BV2(B $BV3(B $BV4(B $BV5(B $BV6(B $BV7(B $BV8(B $BV9(B $BV:(B $BV;(B $BV<(B $BV=(B $BV>(B $BV?(B
$BV@(B $BVA(B $BVB(B $BVC(B $BVD(B $BVE(B $BVF(B $BVG(B $BVH(B $BVI(B $BVJ(B $BVK(B $BVL(B $BVM(B $BVN(B $BVO(B
$BVP(B $BVQ(B $BVR(B $BVS(B $BVT(B $BVU(B $BVV(B $BVW(B $BVX(B $BVY(B $BVZ(B $BV[(B $BV\(B $BV](B $BV^(B $BV_(B
$BV`(B $BVa(B $BVb(B $BVc(B $BVd(B $BVe(B $BVf(B $BVg(B $BVh(B $BVi(B $BVj(B $BVk(B $BVl(B $BVm(B $BVn(B $BVo(B
$BVp(B $BVq(B $BVr(B $BVs(B $BVt(B $BVu(B $BVv(B $BVw(B $BVx(B $BVy(B $BVz(B $BV{(B $BV|(B $BV}(B $BV~(B
$BW!(B $BW"(B $BW#(B $BW$(B $BW%(B $BW&(B $BW'(B $BW((B $BW)(B $BW*(B $BW+(B $BW,(B $BW-(B $BW.(B $BW/(B
$BW0(B $BW1(B $BW2(B $BW3(B $BW4(B $BW5(B $BW6(B $BW7(B $BW8(B $BW9(B $BW:(B $BW;(B $BW<(B $BW=(B $BW>(B $BW?(B
$BW@(B $BWA(B $BWB(B $BWC(B $BWD(B $BWE(B $BWF(B $BWG(B $BWH(B $BWI(B $BWJ(B $BWK(B $BWL(B $BWM(B $BWN(B $BWO(B
$BWP(B $BWQ(B $BWR(B $BWS(B $BWT(B $BWU(B $BWV(B $BWW(B $BWX(B $BWY(B $BWZ(B $BW[(B $BW\(B $BW](B $BW^(B $BW_(B
$BW`(B $BWa(B $BWb(B $BWc(B $BWd(B $BWe(B $BWf(B $BWg(B $BWh(B $BWi(B $BWj(B $BWk(B $BWl(B $BWm(B $BWn(B $BWo(B
$BWp(B $BWq(B $BWr(B $BWs(B $BWt(B $BWu(B $BWv(B $BWw(B $BWx(B $BWy(B $BWz(B $BW{(B $BW|(B $BW}(B $BW~(B
$BX!(B $BX"(B $BX#(B $BX$(B $BX%(B $BX&(B $BX'(B $BX((B $BX)(B $BX*(B $BX+(B $BX,(B $BX-(B $BX.(B $BX/(B
$BX0(B $BX1(B $BX2(B $BX3(B $BX4(B $BX5(B $BX6(B $BX7(B $BX8(B $BX9(B $BX:(B $BX;(B $BX<(B $BX=(B $BX>(B $BX?(B
$BX@(B $BXA(B $BXB(B $BXC(B $BXD(B $BXE(B $BXF(B $BXG(B $BXH(B $BXI(B $BXJ(B $BXK(B $BXL(B $BXM(B $BXN(B $BXO(B
$BXP(B $BXQ(B $BXR(B $BXS(B $BXT(B $BXU(B $BXV(B $BXW(B $BXX(B $BXY(B $BXZ(B $BX[(B $BX\(B $BX](B $BX^(B $BX_(B
$BX`(B $BXa(B $BXb(B $BXc(B $BXd(B $BXe(B $BXf(B $BXg(B $BXh(B $BXi(B $BXj(B $BXk(B $BXl(B $BXm(B $BXn(B $BXo(B
$BXp(B $BXq(B $BXr(B $BXs(B $BXt(B $BXu(B $BXv(B $BXw(B $BXx(B $BXy(B $BXz(B $BX{(B $BX|(B $BX}(B $BX~(B
$BY!(B $BY"(B $BY#(B $BY$(B $BY%(B $BY&(B $BY'(B $BY((B $BY)(B $BY*(B $BY+(B $BY,(B $BY-(B $BY.(B $BY/(B
$BY0(B $BY1(B $BY2(B $BY3(B $BY4(B $BY5(B $BY6(B $BY7(B $BY8(B $BY9(B $BY:(B $BY;(B $BY<(B $BY=(B $BY>(B $BY?(B
$BY@(B $BYA(B $BYB(B $BYC(B $BYD(B $BYE(B $BYF(B $BYG(B $BYH(B $BYI(B $BYJ(B $BYK(B $BYL(B $BYM(B $BYN(B $BYO(B
$BYP(B $BYQ(B $BYR(B $BYS(B $BYT(B $BYU(B $BYV(B $BYW(B $BYX(B $BYY(B $BYZ(B $BY[(B $BY\(B $BY](B $BY^(B $BY_(B
$BY`(B $BYa(B $BYb(B $BYc(B $BYd(B $BYe(B $BYf(B $BYg(B $BYh(B $BYi(B $BYj(B $BYk(B $BYl(B $BYm(B $BYn(B $BYo(B
$BYp(B $BYq(B $BYr(B $BYs(B $BYt(B $BYu(B $BYv(B $BYw(B $BYx(B $BYy(B $BYz(B $BY{(B $BY|(B $BY}(B $BY~(B
$BZ!(B $BZ"(B $BZ#(B $BZ$(B $BZ%(B $BZ&(B $BZ'(B $BZ((B $BZ)(B $BZ*(B $BZ+(B $BZ,(B $BZ-(B $BZ.(B $BZ/(B
$BZ0(B $BZ1(B $BZ2(B $BZ3(B $BZ4(B $BZ5(B $BZ6(B $BZ7(B $BZ8(B $BZ9(B $BZ:(B $BZ;(B $BZ<(B $BZ=(B $BZ>(B $BZ?(B
$BZ@(B $BZA(B $BZB(B $BZC(B $BZD(B $BZE(B $BZF(B $BZG(B $BZH(B $BZI(B $BZJ(B $BZK(B $BZL(B $BZM(B $BZN(B $BZO(B
$BZP(B $BZQ(B $BZR(B $BZS(B $BZT(B $BZU(B $BZV(B $BZW(B $BZX(B $BZY(B $BZZ(B $BZ[(B $BZ\(B $BZ](B $BZ^(B $BZ_(B
$BZ`(B $BZa(B $BZb(B $BZc(B $BZd(B $BZe(B $BZf(B $BZg(B $BZh(B $BZi(B $BZj(B $BZk(B $BZl(B $BZm(B $BZn(B $BZo(B
$BZp(B $BZq(B $BZr(B $BZs(B $BZt(B $BZu(B $BZv(B $BZw(B $BZx(B $BZy(B $BZz(B $BZ{(B $BZ|(B $BZ}(B $BZ~(B
$B[!(B $B["(B $B[#(B $B[$(B $B[%(B $B[&(B $B['(B $B[((B $B[)(B $B[*(B $B[+(B $B[,(B $B[-(B $B[.(B $B[/(B
$B[0(B $B[1(B $B[2(B $B[3(B $B[4(B $B[5(B $B[6(B $B[7(B $B[8(B $B[9(B $B[:(B $B[;(B $B[<(B $B[=(B $B[>(B $B[?(B
$B[@(B $B[A(B $B[B(B $B[C(B $B[D(B $B[E(B $B[F(B $B[G(B $B[H(B $B[I(B $B[J(B $B[K(B $B[L(B $B[M(B $B[N(B $B[O(B
$B[P(B $B[Q(B $B[R(B $B[S(B $B[T(B $B[U(B $B[V(B $B[W(B $B[X(B $B[Y(B $B[Z(B $B[[(B $B[\(B $B[](B $B[^(B $B[_(B
$B[`(B $B[a(B $B[b(B $B[c(B $B[d(B $B[e(B $B[f(B $B[g(B $B[h(B $B[i(B $B[j(B $B[k(B $B[l(B $B[m(B $B[n(B $B[o(B
$B[p(B $B[q(B $B[r(B $B[s(B $B[t(B $B[u(B $B[v(B $B[w(B $B[x(B $B[y(B $B[z(B $B[{(B $B[|(B $B[}(B $B[~(B
$B\!(B $B\"(B $B\#(B $B\$(B $B\%(B $B\&(B $B\'(B $B\((B $B\)(B $B\*(B $B\+(B $B\,(B $B\-(B $B\.(B $B\/(B
$B\0(B $B\1(B $B\2(B $B\3(B $B\4(B $B\5(B $B\6(B $B\7(B $B\8(B $B\9(B $B\:(B $B\;(B $B\<(B $B\=(B $B\>(B $B\?(B
$B\@(B $B\A(B $B\B(B $B\C(B $B\D(B $B\E(B $B\F(B $B\G(B $B\H(B $B\I(B $B\J(B $B\K(B $B\L(B $B\M(B $B\N(B $B\O(B
$B\P(B $B\Q(B $B\R(B $B\S(B $B\T(B $B\U(B $B\V(B $B\W(B $B\X(B $B\Y(B $B\Z(B $B\[(B $B\\(B $B\](B $B\^(B $B\_(B
$B\`(B $B\a(B $B\b(B $B\c(B $B\d(B $B\e(B $B\f(B $B\g(B $B\h(B $B\i(B $B\j(B $B\k(B $B\l(B $B\m(B $B\n(B $B\o(B
$B\p(B $B\q(B $B\r(B $B\s(B $B\t(B $B\u(B $B\v(B $B\w(B $B\x(B $B\y(B $B\z(B $B\{(B $B\|(B $B\}(B $B\~(B
$B]!(B $B]"(B $B]#(B $B]$(B $B]%(B $B]&(B $B]'(B $B]((B $B])(B $B]*(B $B]+(B $B],(B $B]-(B $B].(B $B]/(B
$B]0(B $B]1(B $B]2(B $B]3(B $B]4(B $B]5(B $B]6(B $B]7(B $B]8(B $B]9(B $B]:(B $B];(B $B]<(B $B]=(B $B]>(B $B]?(B
$B]@(B $B]A(B $B]B(B $B]C(B $B]D(B $B]E(B $B]F(B $B]G(B $B]H(B $B]I(B $B]J(B $B]K(B $B]L(B $B]M(B $B]N(B $B]O(B
$B]P(B $B]Q(B $B]R(B $B]S(B $B]T(B $B]U(B $B]V(B $B]W(B $B]X(B $B]Y(B $B]Z(B $B][(B $B]\(B $B]](B $B]^(B $B]_(B
$B]`(B $B]a(B $B]b(B $B]c(B $B]d(B $B]e(B $B]f(B $B]g(B $B]h(B $B]i(B $B]j(B $B]k(B $B]l(B $B]m(B $B]n(B $B]o(B
$B]p(B $B]q(B $B]r(B $B]s(B $B]t(B $B]u(B $B]v(B $B]w(B $B]x(B $B]y(B $B]z(B $B]{(B $B]|(B $B]}(B $B]~(B
$B^!(B $B^"(B $B^#(B $B^$(B $B^%(B $B^&(B $B^'(B $B^((B $B^)(B $B^*(B $B^+(B $B^,(B $B^-(B $B^.(B $B^/(B
$B^0(B $B^1(B $B^2(B $B^3(B $B^4(B $B^5(B $B^6(B $B^7(B $B^8(B $B^9(B $B^:(B $B^;(B $B^<(B $B^=(B $B^>(B $B^?(B
$B^@(B $B^A(B $B^B(B $B^C(B $B^D(B $B^E(B $B^F(B $B^G(B $B^H(B $B^I(B $B^J(B $B^K(B $B^L(B $B^M(B $B^N(B $B^O(B
$B^P(B $B^Q(B $B^R(B $B^S(B $B^T(B $B^U(B $B^V(B $B^W(B $B^X(B $B^Y(B $B^Z(B $B^[(B $B^\(B $B^](B $B^^(B $B^_(B
$B^`(B $B^a(B $B^b(B $B^c(B $B^d(B $B^e(B $B^f(B $B^g(B $B^h(B $B^i(B $B^j(B $B^k(B $B^l(B $B^m(B $B^n(B $B^o(B
$B^p(B $B^q(B $B^r(B $B^s(B $B^t(B $B^u(B $B^v(B $B^w(B $B^x(B $B^y(B $B^z(B $B^{(B $B^|(B $B^}(B $B^~(B
$B_!(B $B_"(B $B_#(B $B_$(B $B_%(B $B_&(B $B_'(B $B_((B $B_)(B $B_*(B $B_+(B $B_,(B $B_-(B $B_.(B $B_/(B
$B_0(B $B_1(B $B_2(B $B_3(B $B_4(B $B_5(B $B_6(B $B_7(B $B_8(B $B_9(B $B_:(B $B_;(B $B_<(B $B_=(B $B_>(B $B_?(B
$B_@(B $B_A(B $B_B(B $B_C(B $B_D(B $B_E(B $B_F(B $B_G(B $B_H(B $B_I(B $B_J(B $B_K(B $B_L(B $B_M(B $B_N(B $B_O(B
$B_P(B $B_Q(B $B_R(B $B_S(B $B_T(B $B_U(B $B_V(B $B_W(B $B_X(B $B_Y(B $B_Z(B $B_[(B $B_\(B $B_](B $B_^(B $B__(B
$B_`(B $B_a(B $B_b(B $B_c(B $B_d(B $B_e(B $B_f(B $B_g(B $B_h(B $B_i(B $B_j(B $B_k(B $B_l(B $B_m(B $B_n(B $B_o(B
$B_p(B $B_q(B $B_r(B $B_s(B $B_t(B $B_u(B $B_v(B $B_w(B $B_x(B $B_y(B $B_z(B $B_{(B $B_|(B $B_}(B $B_~(B
$B`!(B $B`"(B $B`#(B $B`$(B $B`%(B $B`&(B $B`'(B $B`((B $B`)(B $B`*(B $B`+(B $B`,(B $B`-(B $B`.(B $B`/(B
$B`0(B $B`1(B $B`2(B $B`3(B $B`4(B $B`5(B $B`6(B $B`7(B $B`8(B $B`9(B $B`:(B $B`;(B $B`<(B $B`=(B $B`>(B $B`?(B
$B`@(B $B`A(B $B`B(B $B`C(B $B`D(B $B`E(B $B`F(B $B`G(B $B`H(B $B`I(B $B`J(B $B`K(B $B`L(B $B`M(B $B`N(B $B`O(B
$B`P(B $B`Q(B $B`R(B $B`S(B $B`T(B $B`U(B $B`V(B $B`W(B $B`X(B $B`Y(B $B`Z(B $B`[(B $B`\(B $B`](B $B`^(B $B`_(B
$B``(B $B`a(B $B`b(B $B`c(B $B`d(B $B`e(B $B`f(B $B`g(B $B`h(B $B`i(B $B`j(B $B`k(B $B`l(B $B`m(B $B`n(B $B`o(B
$B`p(B $B`q(B $B`r(B $B`s(B $B`t(B $B`u(B $B`v(B $B`w(B $B`x(B $B`y(B $B`z(B $B`{(B $B`|(B $B`}(B $B`~(B
$Ba!(B $Ba"(B $Ba#(B $Ba$(B $Ba%(B $Ba&(B $Ba'(B $Ba((B $Ba)(B $Ba*(B $Ba+(B $Ba,(B $Ba-(B $Ba.(B $Ba/(B
$Ba0(B $Ba1(B $Ba2(B $Ba3(B $Ba4(B $Ba5(B $Ba6(B $Ba7(B $Ba8(B $Ba9(B $Ba:(B $Ba;(B $Ba<(B $Ba=(B $Ba>(B $Ba?(B
$Ba@(B $BaA(B $BaB(B $BaC(B $BaD(B $BaE(B $BaF(B $BaG(B $BaH(B $BaI(B $BaJ(B $BaK(B $BaL(B $BaM(B $BaN(B $BaO(B
$BaP(B $BaQ(B $BaR(B $BaS(B $BaT(B $BaU(B $BaV(B $BaW(B $BaX(B $BaY(B $BaZ(B $Ba[(B $Ba\(B $Ba](B $Ba^(B $Ba_(B
$Ba`(B $Baa(B $Bab(B $Bac(B $Bad(B $Bae(B $Baf(B $Bag(B $Bah(B $Bai(B $Baj(B $Bak(B $Bal(B $Bam(B $Ban(B $Bao(B
$Bap(B $Baq(B $Bar(B $Bas(B $Bat(B $Bau(B $Bav(B $Baw(B $Bax(B $Bay(B $Baz(B $Ba{(B $Ba|(B $Ba}(B $Ba~(B
$Bb!(B $Bb"(B $Bb#(B $Bb$(B $Bb%(B $Bb&(B $Bb'(B $Bb((B $Bb)(B $Bb*(B $Bb+(B $Bb,(B $Bb-(B $Bb.(B $Bb/(B
$Bb0(B $Bb1(B $Bb2(B $Bb3(B $Bb4(B $Bb5(B $Bb6(B $Bb7(B $Bb8(B $Bb9(B $Bb:(B $Bb;(B $Bb<(B $Bb=(B $Bb>(B $Bb?(B
$Bb@(B $BbA(B $BbB(B $BbC(B $BbD(B $BbE(B $BbF(B $BbG(B $BbH(B $BbI(B $BbJ(B $BbK(B $BbL(B $BbM(B $BbN(B $BbO(B
$BbP(B $BbQ(B $BbR(B $BbS(B $BbT(B $BbU(B $BbV(B $BbW(B $BbX(B $BbY(B $BbZ(B $Bb[(B $Bb\(B $Bb](B $Bb^(B $Bb_(B
$Bb`(B $Bba(B $Bbb(B $Bbc(B $Bbd(B $Bbe(B $Bbf(B $Bbg(B $Bbh(B $Bbi(B $Bbj(B $Bbk(B $Bbl(B $Bbm(B $Bbn(B $Bbo(B
$Bbp(B $Bbq(B $Bbr(B $Bbs(B $Bbt(B $Bbu(B $Bbv(B $Bbw(B $Bbx(B $Bby(B $Bbz(B $Bb{(B $Bb|(B $Bb}(B $Bb~(B
$Bc!(B $Bc"(B $Bc#(B $Bc$(B $Bc%(B $Bc&(B $Bc'(B $Bc((B $Bc)(B $Bc*(B $Bc+(B $Bc,(B $Bc-(B $Bc.(B $Bc/(B
$Bc0(B $Bc1(B $Bc2(B $Bc3(B $Bc4(B $Bc5(B $Bc6(B $Bc7(B $Bc8(B $Bc9(B $Bc:(B $Bc;(B $Bc<(B $Bc=(B $Bc>(B $Bc?(B
$Bc@(B $BcA(B $BcB(B $BcC(B $BcD(B $BcE(B $BcF(B $BcG(B $BcH(B $BcI(B $BcJ(B $BcK(B $BcL(B $BcM(B $BcN(B $BcO(B
$BcP(B $BcQ(B $BcR(B $BcS(B $BcT(B $BcU(B $BcV(B $BcW(B $BcX(B $BcY(B $BcZ(B $Bc[(B $Bc\(B $Bc](B $Bc^(B $Bc_(B
$Bc`(B $Bca(B $Bcb(B $Bcc(B $Bcd(B $Bce(B $Bcf(B $Bcg(B $Bch(B $Bci(B $Bcj(B $Bck(B $Bcl(B $Bcm(B $Bcn(B $Bco(B
$Bcp(B $Bcq(B $Bcr(B $Bcs(B $Bct(B $Bcu(B $Bcv(B $Bcw(B $Bcx(B $Bcy(B $Bcz(B $Bc{(B $Bc|(B $Bc}(B $Bc~(B
$Bd!(B $Bd"(B $Bd#(B $Bd$(B $Bd%(B $Bd&(B $Bd'(B $Bd((B $Bd)(B $Bd*(B $Bd+(B $Bd,(B $Bd-(B $Bd.(B $Bd/(B
$Bd0(B $Bd1(B $Bd2(B $Bd3(B $Bd4(B $Bd5(B $Bd6(B $Bd7(B $Bd8(B $Bd9(B $Bd:(B $Bd;(B $Bd<(B $Bd=(B $Bd>(B $Bd?(B
$Bd@(B $BdA(B $BdB(B $BdC(B $BdD(B $BdE(B $BdF(B $BdG(B $BdH(B $BdI(B $BdJ(B $BdK(B $BdL(B $BdM(B $BdN(B $BdO(B
$BdP(B $BdQ(B $BdR(B $BdS(B $BdT(B $BdU(B $BdV(B $BdW(B $BdX(B $BdY(B $BdZ(B $Bd[(B $Bd\(B $Bd](B $Bd^(B $Bd_(B
$Bd`(B $Bda(B $Bdb(B $Bdc(B $Bdd(B $Bde(B $Bdf(B $Bdg(B $Bdh(B $Bdi(B $Bdj(B $Bdk(B $Bdl(B $Bdm(B $Bdn(B $Bdo(B
$Bdp(B $Bdq(B $Bdr(B $Bds(B $Bdt(B $Bdu(B $Bdv(B $Bdw(B $Bdx(B $Bdy(B $Bdz(B $Bd{(B $Bd|(B $Bd}(B $Bd~(B
$Be!(B $Be"(B $Be#(B $Be$(B $Be%(B $Be&(B $Be'(B $Be((B $Be)(B $Be*(B $Be+(B $Be,(B $Be-(B $Be.(B $Be/(B
$Be0(B $Be1(B $Be2(B $Be3(B $Be4(B $Be5(B $Be6(B $Be7(B $Be8(B $Be9(B $Be:(B $Be;(B $Be<(B $Be=(B $Be>(B $Be?(B
$Be@(B $BeA(B $BeB(B $BeC(B $BeD(B $BeE(B $BeF(B $BeG(B $BeH(B $BeI(B $BeJ(B $BeK(B $BeL(B $BeM(B $BeN(B $BeO(B
$BeP(B $BeQ(B $BeR(B $BeS(B $BeT(B $BeU(B $BeV(B $BeW(B $BeX(B $BeY(B $BeZ(B $Be[(B $Be\(B $Be](B $Be^(B $Be_(B
$Be`(B $Bea(B $Beb(B $Bec(B $Bed(B $Bee(B $Bef(B $Beg(B $Beh(B $Bei(B $Bej(B $Bek(B $Bel(B $Bem(B $Ben(B $Beo(B
$Bep(B $Beq(B $Ber(B $Bes(B $Bet(B $Beu(B $Bev(B $Bew(B $Bex(B $Bey(B $Bez(B $Be{(B $Be|(B $Be}(B $Be~(B
$Bf!(B $Bf"(B $Bf#(B $Bf$(B $Bf%(B $Bf&(B $Bf'(B $Bf((B $Bf)(B $Bf*(B $Bf+(B $Bf,(B $Bf-(B $Bf.(B $Bf/(B
$Bf0(B $Bf1(B $Bf2(B $Bf3(B $Bf4(B $Bf5(B $Bf6(B $Bf7(B $Bf8(B $Bf9(B $Bf:(B $Bf;(B $Bf<(B $Bf=(B $Bf>(B $Bf?(B
$Bf@(B $BfA(B $BfB(B $BfC(B $BfD(B $BfE(B $BfF(B $BfG(B $BfH(B $BfI(B $BfJ(B $BfK(B $BfL(B $BfM(B $BfN(B $BfO(B
$BfP(B $BfQ(B $BfR(B $BfS(B $BfT(B $BfU(B $BfV(B $BfW(B $BfX(B $BfY(B $BfZ(B $Bf[(B $Bf\(B $Bf](B $Bf^(B $Bf_(B
$Bf`(B $Bfa(B $Bfb(B $Bfc(B $Bfd(B $Bfe(B $Bff(B $Bfg(B $Bfh(B $Bfi(B $Bfj(B $Bfk(B $Bfl(B $Bfm(B $Bfn(B $Bfo(B
$Bfp(B $Bfq(B $Bfr(B $Bfs(B $Bft(B $Bfu(B $Bfv(B $Bfw(B $Bfx(B $Bfy(B $Bfz(B $Bf{(B $Bf|(B $Bf}(B $Bf~(B
$Bg!(B $Bg"(B $Bg#(B $Bg$(B $Bg%(B $Bg&(B $Bg'(B $Bg((B $Bg)(B $Bg*(B $Bg+(B $Bg,(B $Bg-(B $Bg.(B $Bg/(B
$Bg0(B $Bg1(B $Bg2(B $Bg3(B $Bg4(B $Bg5(B $Bg6(B $Bg7(B $Bg8(B $Bg9(B $Bg:(B $Bg;(B $Bg<(B $Bg=(B $Bg>(B $Bg?(B
$Bg@(B $BgA(B $BgB(B $BgC(B $BgD(B $BgE(B $BgF(B $BgG(B $BgH(B $BgI(B $BgJ(B $BgK(B $BgL(B $BgM(B $BgN(B $BgO(B
$BgP(B $BgQ(B $BgR(B $BgS(B $BgT(B $BgU(B $BgV(B $BgW(B $BgX(B $BgY(B $BgZ(B $Bg[(B $Bg\(B $Bg](B $Bg^(B $Bg_(B
$Bg`(B $Bga(B $Bgb(B $Bgc(B $Bgd(B $Bge(B $Bgf(B $Bgg(B $Bgh(B $Bgi(B $Bgj(B $Bgk(B $Bgl(B $Bgm(B $Bgn(B $Bgo(B
$Bgp(B $Bgq(B $Bgr(B $Bgs(B $Bgt(B $Bgu(B $Bgv(B $Bgw(B $Bgx(B $Bgy(B $Bgz(B $Bg{(B $Bg|(B $Bg}(B $Bg~(B
$Bh!(B $Bh"(B $Bh#(B $Bh$(B $Bh%(B $Bh&(B $Bh'(B $Bh((B $Bh)(B $Bh*(B $Bh+(B $Bh,(B $Bh-(B $Bh.(B $Bh/(B
$Bh0(B $Bh1(B $Bh2(B $Bh3(B $Bh4(B $Bh5(B $Bh6(B $Bh7(B $Bh8(B $Bh9(B $Bh:(B $Bh;(B $Bh<(B $Bh=(B $Bh>(B $Bh?(B
$Bh@(B $BhA(B $BhB(B $BhC(B $BhD(B $BhE(B $BhF(B $BhG(B $BhH(B $BhI(B $BhJ(B $BhK(B $BhL(B $BhM(B $BhN(B $BhO(B
$BhP(B $BhQ(B $BhR(B $BhS(B $BhT(B $BhU(B $BhV(B $BhW(B $BhX(B $BhY(B $BhZ(B $Bh[(B $Bh\(B $Bh](B $Bh^(B $Bh_(B
$Bh`(B $Bha(B $Bhb(B $Bhc(B $Bhd(B $Bhe(B $Bhf(B $Bhg(B $Bhh(B $Bhi(B $Bhj(B $Bhk(B $Bhl(B $Bhm(B $Bhn(B $Bho(B
$Bhp(B $Bhq(B $Bhr(B $Bhs(B $Bht(B $Bhu(B $Bhv(B $Bhw(B $Bhx(B $Bhy(B $Bhz(B $Bh{(B $Bh|(B $Bh}(B $Bh~(B
$Bi!(B $Bi"(B $Bi#(B $Bi$(B $Bi%(B $Bi&(B $Bi'(B $Bi((B $Bi)(B $Bi*(B $Bi+(B $Bi,(B $Bi-(B $Bi.(B $Bi/(B
$Bi0(B $Bi1(B $Bi2(B $Bi3(B $Bi4(B $Bi5(B $Bi6(B $Bi7(B $Bi8(B $Bi9(B $Bi:(B $Bi;(B $Bi<(B $Bi=(B $Bi>(B $Bi?(B
$Bi@(B $BiA(B $BiB(B $BiC(B $BiD(B $BiE(B $BiF(B $BiG(B $BiH(B $BiI(B $BiJ(B $BiK(B $BiL(B $BiM(B $BiN(B $BiO(B
$BiP(B $BiQ(B $BiR(B $BiS(B $BiT(B $BiU(B $BiV(B $BiW(B $BiX(B $BiY(B $BiZ(B $Bi[(B $Bi\(B $Bi](B $Bi^(B $Bi_(B
$Bi`(B $Bia(B $Bib(B $Bic(B $Bid(B $Bie(B $Bif(B $Big(B $Bih(B $Bii(B $Bij(B $Bik(B $Bil(B $Bim(B $Bin(B $Bio(B
$Bip(B $Biq(B $Bir(B $Bis(B $Bit(B $Biu(B $Biv(B $Biw(B $Bix(B $Biy(B $Biz(B $Bi{(B $Bi|(B $Bi}(B $Bi~(B
$Bj!(B $Bj"(B $Bj#(B $Bj$(B $Bj%(B $Bj&(B $Bj'(B $Bj((B $Bj)(B $Bj*(B $Bj+(B $Bj,(B $Bj-(B $Bj.(B $Bj/(B
$Bj0(B $Bj1(B $Bj2(B $Bj3(B $Bj4(B $Bj5(B $Bj6(B $Bj7(B $Bj8(B $Bj9(B $Bj:(B $Bj;(B $Bj<(B $Bj=(B $Bj>(B $Bj?(B
$Bj@(B $BjA(B $BjB(B $BjC(B $BjD(B $BjE(B $BjF(B $BjG(B $BjH(B $BjI(B $BjJ(B $BjK(B $BjL(B $BjM(B $BjN(B $BjO(B
$BjP(B $BjQ(B $BjR(B $BjS(B $BjT(B $BjU(B $BjV(B $BjW(B $BjX(B $BjY(B $BjZ(B $Bj[(B $Bj\(B $Bj](B $Bj^(B $Bj_(B
$Bj`(B $Bja(B $Bjb(B $Bjc(B $Bjd(B $Bje(B $Bjf(B $Bjg(B $Bjh(B $Bji(B $Bjj(B $Bjk(B $Bjl(B $Bjm(B $Bjn(B $Bjo(B
$Bjp(B $Bjq(B $Bjr(B $Bjs(B $Bjt(B $Bju(B $Bjv(B $Bjw(B $Bjx(B $Bjy(B $Bjz(B $Bj{(B $Bj|(B $Bj}(B $Bj~(B
$Bk!(B $Bk"(B $Bk#(B $Bk$(B $Bk%(B $Bk&(B $Bk'(B $Bk((B $Bk)(B $Bk*(B $Bk+(B $Bk,(B $Bk-(B $Bk.(B $Bk/(B
$Bk0(B $Bk1(B $Bk2(B $Bk3(B $Bk4(B $Bk5(B $Bk6(B $Bk7(B $Bk8(B $Bk9(B $Bk:(B $Bk;(B $Bk<(B $Bk=(B $Bk>(B $Bk?(B
$Bk@(B $BkA(B $BkB(B $BkC(B $BkD(B $BkE(B $BkF(B $BkG(B $BkH(B $BkI(B $BkJ(B $BkK(B $BkL(B $BkM(B $BkN(B $BkO(B
$BkP(B $BkQ(B $BkR(B $BkS(B $BkT(B $BkU(B $BkV(B $BkW(B $BkX(B $BkY(B $BkZ(B $Bk[(B $Bk\(B $Bk](B $Bk^(B $Bk_(B
$Bk`(B $Bka(B $Bkb(B $Bkc(B $Bkd(B $Bke(B $Bkf(B $Bkg(B $Bkh(B $Bki(B $Bkj(B $Bkk(B $Bkl(B $Bkm(B $Bkn(B $Bko(B
$Bkp(B $Bkq(B $Bkr(B $Bks(B $Bkt(B $Bku(B $Bkv(B $Bkw(B $Bkx(B $Bky(B $Bkz(B $Bk{(B $Bk|(B $Bk}(B $Bk~(B
$Bl!(B $Bl"(B $Bl#(B $Bl$(B $Bl%(B $Bl&(B $Bl'(B $Bl((B $Bl)(B $Bl*(B $Bl+(B $Bl,(B $Bl-(B $Bl.(B $Bl/(B
$Bl0(B $Bl1(B $Bl2(B $Bl3(B $Bl4(B $Bl5(B $Bl6(B $Bl7(B $Bl8(B $Bl9(B $Bl:(B $Bl;(B $Bl<(B $Bl=(B $Bl>(B $Bl?(B
$Bl@(B $BlA(B $BlB(B $BlC(B $BlD(B $BlE(B $BlF(B $BlG(B $BlH(B $BlI(B $BlJ(B $BlK(B $BlL(B $BlM(B $BlN(B $BlO(B
$BlP(B $BlQ(B $BlR(B $BlS(B $BlT(B $BlU(B $BlV(B $BlW(B $BlX(B $BlY(B $BlZ(B $Bl[(B $Bl\(B $Bl](B $Bl^(B $Bl_(B
$Bl`(B $Bla(B $Blb(B $Blc(B $Bld(B $Ble(B $Blf(B $Blg(B $Blh(B $Bli(B $Blj(B $Blk(B $Bll(B $Blm(B $Bln(B $Blo(B
$Blp(B $Blq(B $Blr(B $Bls(B $Blt(B $Blu(B $Blv(B $Blw(B $Blx(B $Bly(B $Blz(B $Bl{(B $Bl|(B $Bl}(B $Bl~(B
$Bm!(B $Bm"(B $Bm#(B $Bm$(B $Bm%(B $Bm&(B $Bm'(B $Bm((B $Bm)(B $Bm*(B $Bm+(B $Bm,(B $Bm-(B $Bm.(B $Bm/(B
$Bm0(B $Bm1(B $Bm2(B $Bm3(B $Bm4(B $Bm5(B $Bm6(B $Bm7(B $Bm8(B $Bm9(B $Bm:(B $Bm;(B $Bm<(B $Bm=(B $Bm>(B $Bm?(B
$Bm@(B $BmA(B $BmB(B $BmC(B $BmD(B $BmE(B $BmF(B $BmG(B $BmH(B $BmI(B $BmJ(B $BmK(B $BmL(B $BmM(B $BmN(B $BmO(B
$BmP(B $BmQ(B $BmR(B $BmS(B $BmT(B $BmU(B $BmV(B $BmW(B $BmX(B $BmY(B $BmZ(B $Bm[(B $Bm\(B $Bm](B $Bm^(B $Bm_(B
$Bm`(B $Bma(B $Bmb(B $Bmc(B $Bmd(B $Bme(B $Bmf(B $Bmg(B $Bmh(B $Bmi(B $Bmj(B $Bmk(B $Bml(B $Bmm(B $Bmn(B $Bmo(B
$Bmp(B $Bmq(B $Bmr(B $Bms(B $Bmt(B $Bmu(B $Bmv(B $Bmw(B $Bmx(B $Bmy(B $Bmz(B $Bm{(B $Bm|(B $Bm}(B $Bm~(B
$Bn!(B $Bn"(B $Bn#(B $Bn$(B $Bn%(B $Bn&(B $Bn'(B $Bn((B $Bn)(B $Bn*(B $Bn+(B $Bn,(B $Bn-(B $Bn.(B $Bn/(B
$Bn0(B $Bn1(B $Bn2(B $Bn3(B $Bn4(B $Bn5(B $Bn6(B $Bn7(B $Bn8(B $Bn9(B $Bn:(B $Bn;(B $Bn<(B $Bn=(B $Bn>(B $Bn?(B
$Bn@(B $BnA(B $BnB(B $BnC(B $BnD(B $BnE(B $BnF(B $BnG(B $BnH(B $BnI(B $BnJ(B $BnK(B $BnL(B $BnM(B $BnN(B $BnO(B
$BnP(B $BnQ(B $BnR(B $BnS(B $BnT(B $BnU(B $BnV(B $BnW(B $BnX(B $BnY(B $BnZ(B $Bn[(B $Bn\(B $Bn](B $Bn^(B $Bn_(B
$Bn`(B $Bna(B $Bnb(B $Bnc(B $Bnd(B $Bne(B $Bnf(B $Bng(B $Bnh(B $Bni(B $Bnj(B $Bnk(B $Bnl(B $Bnm(B $Bnn(B $Bno(B
$Bnp(B $Bnq(B $Bnr(B $Bns(B $Bnt(B $Bnu(B $Bnv(B $Bnw(B $Bnx(B $Bny(B $Bnz(B $Bn{(B $Bn|(B $Bn}(B $Bn~(B
$Bo!(B $Bo"(B $Bo#(B $Bo$(B $Bo%(B $Bo&(B $Bo'(B $Bo((B $Bo)(B $Bo*(B $Bo+(B $Bo,(B $Bo-(B $Bo.(B $Bo/(B
$Bo0(B $Bo1(B $Bo2(B $Bo3(B $Bo4(B $Bo5(B $Bo6(B $Bo7(B $Bo8(B $Bo9(B $Bo:(B $Bo;(B $Bo<(B $Bo=(B $Bo>(B $Bo?(B
$Bo@(B $BoA(B $BoB(B $BoC(B $BoD(B $BoE(B $BoF(B $BoG(B $BoH(B $BoI(B $BoJ(B $BoK(B $BoL(B $BoM(B $BoN(B $BoO(B
$BoP(B $BoQ(B $BoR(B $BoS(B $BoT(B $BoU(B $BoV(B $BoW(B $BoX(B $BoY(B $BoZ(B $Bo[(B $Bo\(B $Bo](B $Bo^(B $Bo_(B
$Bo`(B $Boa(B $Bob(B $Boc(B $Bod(B $Boe(B $Bof(B $Bog(B $Boh(B $Boi(B $Boj(B $Bok(B $Bol(B $Bom(B $Bon(B $Boo(B
$Bop(B $Boq(B $Bor(B $Bos(B $Bot(B $Bou(B $Bov(B $Bow(B $Box(B $Boy(B $Boz(B $Bo{(B $Bo|(B $Bo}(B $Bo~(B
$Bp!(B $Bp"(B $Bp#(B $Bp$(B $Bp%(B $Bp&(B $Bp'(B $Bp((B $Bp)(B $Bp*(B $Bp+(B $Bp,(B $Bp-(B $Bp.(B $Bp/(B
$Bp0(B $Bp1(B $Bp2(B $Bp3(B $Bp4(B $Bp5(B $Bp6(B $Bp7(B $Bp8(B $Bp9(B $Bp:(B $Bp;(B $Bp<(B $Bp=(B $Bp>(B $Bp?(B
$Bp@(B $BpA(B $BpB(B $BpC(B $BpD(B $BpE(B $BpF(B $BpG(B $BpH(B $BpI(B $BpJ(B $BpK(B $BpL(B $BpM(B $BpN(B $BpO(B
$BpP(B $BpQ(B $BpR(B $BpS(B $BpT(B $BpU(B $BpV(B $BpW(B $BpX(B $BpY(B $BpZ(B $Bp[(B $Bp\(B $Bp](B $Bp^(B $Bp_(B
$Bp`(B $Bpa(B $Bpb(B $Bpc(B $Bpd(B $Bpe(B $Bpf(B $Bpg(B $Bph(B $Bpi(B $Bpj(B $Bpk(B $Bpl(B $Bpm(B $Bpn(B $Bpo(B
$Bpp(B $Bpq(B $Bpr(B $Bps(B $Bpt(B $Bpu(B $Bpv(B $Bpw(B $Bpx(B $Bpy(B $Bpz(B $Bp{(B $Bp|(B $Bp}(B $Bp~(B
$Bq!(B $Bq"(B $Bq#(B $Bq$(B $Bq%(B $Bq&(B $Bq'(B $Bq((B $Bq)(B $Bq*(B $Bq+(B $Bq,(B $Bq-(B $Bq.(B $Bq/(B
$Bq0(B $Bq1(B $Bq2(B $Bq3(B $Bq4(B $Bq5(B $Bq6(B $Bq7(B $Bq8(B $Bq9(B $Bq:(B $Bq;(B $Bq<(B $Bq=(B $Bq>(B $Bq?(B
$Bq@(B $BqA(B $BqB(B $BqC(B $BqD(B $BqE(B $BqF(B $BqG(B $BqH(B $BqI(B $BqJ(B $BqK(B $BqL(B $BqM(B $BqN(B $BqO(B
$BqP(B $BqQ(B $BqR(B $BqS(B $BqT(B $BqU(B $BqV(B $BqW(B $BqX(B $BqY(B $BqZ(B $Bq[(B $Bq\(B $Bq](B $Bq^(B $Bq_(B
$Bq`(B $Bqa(B $Bqb(B $Bqc(B $Bqd(B $Bqe(B $Bqf(B $Bqg(B $Bqh(B $Bqi(B $Bqj(B $Bqk(B $Bql(B $Bqm(B $Bqn(B $Bqo(B
$Bqp(B $Bqq(B $Bqr(B $Bqs(B $Bqt(B $Bqu(B $Bqv(B $Bqw(B $Bqx(B $Bqy(B $Bqz(B $Bq{(B $Bq|(B $Bq}(B $Bq~(B
$Br!(B $Br"(B $Br#(B $Br$(B $Br%(B $Br&(B $Br'(B $Br((B $Br)(B $Br*(B $Br+(B $Br,(B $Br-(B $Br.(B $Br/(B
$Br0(B $Br1(B $Br2(B $Br3(B $Br4(B $Br5(B $Br6(B $Br7(B $Br8(B $Br9(B $Br:(B $Br;(B $Br<(B $Br=(B $Br>(B $Br?(B
$Br@(B $BrA(B $BrB(B $BrC(B $BrD(B $BrE(B $BrF(B $BrG(B $BrH(B $BrI(B $BrJ(B $BrK(B $BrL(B $BrM(B $BrN(B $BrO(B
$BrP(B $BrQ(B $BrR(B $BrS(B $BrT(B $BrU(B $BrV(B $BrW(B $BrX(B $BrY(B $BrZ(B $Br[(B $Br\(B $Br](B $Br^(B $Br_(B
$Br`(B $Bra(B $Brb(B $Brc(B $Brd(B $Bre(B $Brf(B $Brg(B $Brh(B $Bri(B $Brj(B $Brk(B $Brl(B $Brm(B $Brn(B $Bro(B
$Brp(B $Brq(B $Brr(B $Brs(B $Brt(B $Bru(B $Brv(B $Brw(B $Brx(B $Bry(B $Brz(B $Br{(B $Br|(B $Br}(B $Br~(B
$Bs!(B $Bs"(B $Bs#(B $Bs$(B $Bs%(B $Bs&(B $Bs'(B $Bs((B $Bs)(B $Bs*(B $Bs+(B $Bs,(B $Bs-(B $Bs.(B $Bs/(B
$Bs0(B $Bs1(B $Bs2(B $Bs3(B $Bs4(B $Bs5(B $Bs6(B $Bs7(B $Bs8(B $Bs9(B $Bs:(B $Bs;(B $Bs<(B $Bs=(B $Bs>(B $Bs?(B
$Bs@(B $BsA(B $BsB(B $BsC(B $BsD(B $BsE(B $BsF(B $BsG(B $BsH(B $BsI(B $BsJ(B $BsK(B $BsL(B $BsM(B $BsN(B $BsO(B
$BsP(B $BsQ(B $BsR(B $BsS(B $BsT(B $BsU(B $BsV(B $BsW(B $BsX(B $BsY(B $BsZ(B $Bs[(B $Bs\(B $Bs](B $Bs^(B $Bs_(B
$Bs`(B $Bsa(B $Bsb(B $Bsc(B $Bsd(B $Bse(B $Bsf(B $Bsg(B $Bsh(B $Bsi(B $Bsj(B $Bsk(B $Bsl(B $Bsm(B $Bsn(B $Bso(B
$Bsp(B $Bsq(B $Bsr(B $Bss(B $Bst(B $Bsu(B $Bsv(B $Bsw(B $Bsx(B $Bsy(B $Bsz(B $Bs{(B $Bs|(B $Bs}(B $Bs~(B
$Bt!(B $Bt"(B $Bt#(B $Bt$(B $Bt%(B $Bt&(B
JIS0123 ($BF|K\8l(B) $B$3$s$K$A$O(B
JIS -- $B855$(B $B3+H/(B
$B/export/Users/ianl/1.4.2/test/sun/nio/cs/SCCS/s.ISO2022JP.data0%G!<%?%Y!<%9$KAw$k$Y$-$G$J$$$3$H$KCmL\$7$F$/$@$5$$!#(B</p>

View File

@ -0,0 +1,105 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6419791
* @summary
* @author Martin Buchholz
*/
import java.io.*;
import java.util.*;
import java.nio.charset.*;
import java.nio.*;
public class ISO8859x {
final static byte[] lowBytes = new byte[0xa0];
final static char[] lowChars = new char[0xa0];
final static String lowString;
static {
for (int i = 0; i < 0xa0; i++) {
lowBytes[i] = (byte) i;
lowChars[i] = (char) i;
}
lowString = new String(lowChars);
}
private static void testCharset(Charset cs) throws Throwable {
String csn = cs.name();
System.out.println(csn);
check(cs.canEncode());
check(Arrays.equals(lowString.getBytes(csn), lowBytes));
check(new String(lowBytes, csn).equals(lowString));
CharsetEncoder encoder = cs.newEncoder();
CharsetDecoder decoder = cs.newDecoder();
decoder.onUnmappableCharacter(CodingErrorAction.REPORT)
.onMalformedInput(CodingErrorAction.REPORT);
encoder.onUnmappableCharacter(CodingErrorAction.REPORT)
.onMalformedInput(CodingErrorAction.REPORT);
byte[] bytes = new byte[1];
for (int c = 0xa0; c < 0x100; c++) {
try {
bytes[0] = (byte) c;
char[] chars;
try { chars = decoder.decode(ByteBuffer.wrap(bytes)).array(); }
catch (UnmappableCharacterException x) { continue; }
equal(chars.length, 1);
byte[] bytes2 = encoder.encode(CharBuffer.wrap(chars)).array();
check(Arrays.equals(bytes2, bytes));
} catch (Throwable t) {
System.out.printf("cs=%s c=%02x%n", cs, c);
unexpected(t);
}
}
}
private static void realMain(String[] args) throws Throwable {
for (Map.Entry<String,Charset> e
: Charset.availableCharsets().entrySet()) {
String csn = e.getKey();
Charset cs = e.getValue();
if (csn.matches(".*(8859).*"))
try { testCharset(cs); }
catch (Throwable t) { unexpected(t); }
}
}
//--------------------- Infrastructure ---------------------------
static volatile int passed = 0, failed = 0;
static void pass() {passed++;}
static void fail() {failed++; Thread.dumpStack();}
static void fail(String msg) {System.out.println(msg); fail();}
static void unexpected(Throwable t) {failed++; t.printStackTrace();}
static void check(boolean cond) {if (cond) pass(); else fail();}
static void equal(Object x, Object y) {
if (x == null ? y == null : x.equals(y)) pass();
else fail(x + " not equal to " + y);}
public static void main(String[] args) throws Throwable {
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
}

View File

@ -0,0 +1,158 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 4087261 4184592
* @summary Make sure to determine Japanese text encoding as correctly
* as possible.
*/
import java.nio.charset.*;
import java.nio.*;
public class JISAutoDetectTest {
class TestData {
byte[] input;
byte[] input2; // for second call
String expectedCharset;
}
TestData[] data = new TestData[50];
public static void main(String[] argv) throws Exception {
JISAutoDetectTest test = new JISAutoDetectTest();
test.execute();
}
void execute() throws Exception {
CharBuffer output = CharBuffer.allocate(128);
CharBuffer expectedOutput = CharBuffer.allocate(128);
for (int i = 0; i < data.length; i++) {
if (data[i] == null)
break;
CharsetDecoder autoDetect = Charset.forName("JISAutoDetect").newDecoder();
CharsetDecoder dec = Charset.forName(data[i].expectedCharset).newDecoder();
CoderResult ncr, mcr;
output.clear();
expectedOutput.clear();
ncr = autoDetect.decode(ByteBuffer.wrap(data[i].input),
output,
true);
mcr = dec.decode(ByteBuffer.wrap(data[i].input),
expectedOutput,
true);
if (data[i].input2 != null) {
ncr = autoDetect.decode(ByteBuffer.wrap(data[i].input2),
output,
true);
mcr = dec.decode(ByteBuffer.wrap(data[i].input2),
expectedOutput,
true);
}
String testNumber = " (test#: " + i + ")";
if (ncr != mcr)
throw new Exception("JISAutoDetect returned a wrong result");
output.flip();
expectedOutput.flip();
if (output.limit() != expectedOutput.limit())
throw new Exception("JISAutoDetect returned a wrong length"+testNumber);
for (int x = 0; x < output.limit(); x++) {
if (expectedOutput.charAt(x) != output.charAt(x))
throw new Exception("JISAutoDetect returned a wrong string"+testNumber);
}
}
}
public JISAutoDetectTest() {
int i = 0;
// 0
data[i] = new TestData();
data[i].input = new byte[] { (byte)'C', (byte)'o', (byte)'p', (byte)'y',
(byte)'r', (byte)'i', (byte)'g', (byte)'h',
(byte)'t', (byte)' ', (byte)0xa9, (byte)' ',
(byte)'1', (byte)'9', (byte)'9', (byte)'8' };
data[i].expectedCharset = "SJIS";
// 1
i++;
data[i] = new TestData();
data[i].input = new byte[] { (byte)0xbb, (byte)0xdd, (byte)0xcf, (byte)0xb2,
(byte)0xb8, (byte)0xdb, (byte)0xbc, (byte)0xbd,
(byte)0xc3, (byte)0xd1, (byte)0xbd, (byte)0xde,
(byte)0x82, (byte)0xc5, (byte)0x82, (byte)0xb7 };
data[i].expectedCharset = "SJIS";
// 2
i++;
data[i] = new TestData();
data[i].input = new byte[] { (byte)0xbb, (byte)0xdd, (byte)0xcf, (byte)0xb2,
(byte)0xb8, (byte)0xdb, (byte)0xbc, (byte)0xbd,
(byte)0xc3, (byte)0xd1, (byte)0xbd, (byte)0xde};
data[i].expectedCharset = "SJIS";
// 3
i++;
data[i] = new TestData();
data[i].input = new byte[] { (byte)0xbb, (byte)0xdd, (byte)0xcf, (byte)0xb2,
(byte)0xb8, (byte)0xdb, (byte)0xbc, (byte)0xbd,
(byte)0xc3, (byte)0xd1, (byte)0xbd };
data[i].expectedCharset = "SJIS";
// 4
i++;
data[i] = new TestData();
data[i].input = new byte[] { (byte)0x8f, (byte)0xa1, (byte)0xaa };
data[i].expectedCharset = "SJIS";
// 5
i++;
data[i] = new TestData();
data[i].input = new byte[] { (byte)0xa4, (byte)0xd2, (byte)0xa4, (byte)0xe9,
(byte)0xa4, (byte)0xac, (byte)0xa4, (byte)0xca };
data[i].expectedCharset = "EUC_JP";
// 6
i++;
data[i] = new TestData();
data[i].input = new byte[] { (byte)0xbb, (byte)0xdd, (byte)0xcf, (byte)0xb2,
(byte)0xb8, (byte)0xdb, (byte)0xbc, (byte)0xbd,
(byte)0xc3, (byte)0xd1, (byte)0xbd, (byte)0xde,
(byte)0xa4, (byte)0xc7, (byte)0xa4, (byte)0xb9 };
data[i].expectedCharset = "EUC_JP";
// 7 (for 4184592)
i++;
data[i] = new TestData();
data[i].input = new byte[] { (byte)'a', (byte)'b', (byte)'c' };
data[i].input2 = new byte[] { (byte)0x1b, (byte)'$', (byte)'B',
(byte)'#', (byte)'4', (byte)'$', (byte)'5',
(byte)0x1b, (byte)'(', (byte)'B' };
data[i].expectedCharset = "ISO2022JP";
}
}

View File

@ -0,0 +1,80 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4658679 4879644
@summary Checks replacement logic within EUC-TW decoder
*/
/*
* Tests goodness of fix for bugID 4658679: EUC-TW decoder should
* perform replacement when it encounters latin chars outside the
* normal US-ASCII range. For example: Isolated occurrences of
* French accented chars. See bugID: 4658679.
*/
import java.io.*;
public class LatinCharReplacementTWTest {
public static void main(String[] args) throws Exception {
final String bugID = "4658679";
// Attempt to decode
byte[] input = { (byte)0xa1,
(byte)0xf0,
(byte)'r',
(byte)'e',
(byte)'s',
(byte)0xe9, // illegal within EUC-TW
(byte)'r',
(byte)'v',
(byte)0xe9, // illegal within EUC-TW
(byte)'s',
(byte)0xa2,
(byte)0xf8
};
char[] expected = { (char) 0xa7,
(char) 'r',
(char) 'e',
(char) 's',
(char) 0xFFFD, // replacement for accented lowercase e
(char) 'r',
(char) 'v',
(char) 0xFFFD, // replacement for accented lowercase e
(char) 's',
(char) 0xb0 };
ByteArrayInputStream bais = new ByteArrayInputStream(input);
InputStreamReader isr = new InputStreamReader(bais, "x-EUC-TW");
char[] decoded = new char[128];
int numChars = isr.read(decoded);
if (numChars != expected.length) {
throw new Exception("failure of test for bug " + bugID);
}
for (int i = 0 ; i < numChars; i++) {
if (decoded[i] != expected[i])
throw new Exception("failure of test for bug " + bugID);
}
}
}

View File

@ -0,0 +1,55 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4160949
@summary Verify that left over high surrogate does not
cause an UnknownCharacterException when substitutition mode is turned on.
*/
import java.nio.*;
import java.nio.charset.*;
public class LeftOverSurrogate {
public static void main(String args[]) throws Exception {
String s = "abc\uD800\uDC00qrst"; // Valid surrogate
char[] c = s.toCharArray();
CharsetEncoder enc = Charset.forName("ISO8859_1").newEncoder()
.onUnmappableCharacter(CodingErrorAction.REPLACE);
/* Process the first 4 characters, including the high surrogate
which should be stored */
ByteBuffer bb = ByteBuffer.allocate(10);
CharBuffer cb = CharBuffer.wrap(c);
cb.limit(4);
enc.encode(cb, bb, false);
cb.limit(7);
enc.encode(cb, bb, true);
byte[] first = bb.array();
for(int i = 0; i < 7; i++)
System.err.printf("[%d]=%d was %d\n",
i,
(int) first[i] &0xffff,
(int) c[i] & 0xffff);
}
}

View File

@ -0,0 +1,85 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4153987
@summary Malformed surrogates should be handled by the converter in
substitution mode.
*/
import java.io.*;
public class MalformedSurrogates {
public static void main(String[] args) throws Exception {
String fe = System.getProperty("file.encoding");
if ( fe.equalsIgnoreCase("UTF8")
|| fe.equalsIgnoreCase("UTF-8")
|| fe.equalsIgnoreCase("UTF_8"))
// This test is meaningless if the default charset
// does handle surrogates
return;
System.out.println("Testing string conversion...");
/* Example with malformed surrogate, and an offset */
String t = "abc\uD800\uDB00efgh";
String t2 = t.substring(2);
byte[] b = t2.getBytes();
System.err.println(b.length);
for (int i = 0; i < b.length; i++)
System.err.println("[" + i + "]" + "=" + (char) b[i]
+ "=" + (int) b[i]);
if (b.length != 7) {
throw new Exception("Bad string conversion for bad surrogate");
}
/* Example with a proper surrogate, no offset. Always worked */
String t3 = "abc\uD800\uDC00efgh";
byte[] b2 = t3.getBytes();
System.out.println(b2.length);
for(int i = 0; i < b2.length; i++)
System.err.println("[" + i + "]" + "=" + (char) b2[i]);
if (b2.length != 8) {
throw new Exception("Bad string conversion for good surrogate");
}
OutputStream os = new ByteArrayOutputStream();
OutputStreamWriter osw = new OutputStreamWriter(os);
System.out.println("Testing flush....");
/* Check for the case where the converter has a left over
high surrogate when flush is called on the converter */
osw.flush();
String s = "abc\uD800"; // High surrogate
char[] c = s.toCharArray();
osw.write(s, 0, 4);
osw.flush();
System.out.println("Testing convert...");
/* Verify that all other characters go through */
for (int k = 1; k < 65535 ; k++) {
osw.write("Char[" + k + "]=\"" + ((char) k) + "\"");
}
}
}

View File

@ -0,0 +1,282 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 4831163 5053096 5056440
* @summary NIO charset basic verification of JISAutodetect decoder
* @author Martin Buchholz
*/
import java.io.*;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CoderResult;
import static java.lang.System.*;
public class NIOJISAutoDetectTest {
private static int failures = 0;
private static void fail(String failureMsg) {
System.out.println(failureMsg);
failures++;
}
private static void check(boolean cond, String msg) {
if (!cond) {
fail("test failed: " + msg);
new Exception().printStackTrace();
}
}
private static String SJISName() throws Exception {
return detectingCharset(new byte[] {(byte)0xbb, (byte)0xdd,
(byte)0xcf, (byte)0xb2});
}
private static String EUCJName() throws Exception {
return detectingCharset(new byte[] {(byte)0xa4, (byte)0xd2,
(byte)0xa4, (byte)0xe9});
}
private static String detectingCharset(byte[] bytes) throws Exception {
//----------------------------------------------------------------
// Test special public methods of CharsetDecoder while we're here
//----------------------------------------------------------------
CharsetDecoder cd = Charset.forName("JISAutodetect").newDecoder();
check(cd.isAutoDetecting(), "isAutodecting()");
check(! cd.isCharsetDetected(), "isCharsetDetected");
cd.decode(ByteBuffer.wrap(new byte[] {(byte)'A'}));
check(! cd.isCharsetDetected(), "isCharsetDetected");
try {
cd.detectedCharset();
fail("no IllegalStateException");
} catch (IllegalStateException e) {}
cd.decode(ByteBuffer.wrap(bytes));
check(cd.isCharsetDetected(), "isCharsetDetected");
Charset cs = cd.detectedCharset();
check(cs != null, "cs != null");
check(! cs.newDecoder().isAutoDetecting(), "isAutodetecting()");
return cs.name();
}
public static void main(String[] argv) throws Exception {
//----------------------------------------------------------------
// Used to throw BufferOverflowException
//----------------------------------------------------------------
out.println(new String(new byte[] {0x61}, "JISAutoDetect"));
//----------------------------------------------------------------
// InputStreamReader(...JISAutoDetect) used to infloop
//----------------------------------------------------------------
{
byte[] bytes = "ABCD\n".getBytes();
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
InputStreamReader isr = new InputStreamReader(bais, "JISAutoDetect");
BufferedReader reader = new BufferedReader(isr);
check (reader.readLine().equals("ABCD"), "first read gets text");
// used to return "ABCD" on second and subsequent reads
check (reader.readLine() == null, "second read gets null");
}
//----------------------------------------------------------------
// Check all Japanese chars for sanity
//----------------------------------------------------------------
String SJIS = SJISName();
String EUCJ = EUCJName();
out.printf("SJIS charset is %s%n", SJIS);
out.printf("EUCJ charset is %s%n", EUCJ);
int cnt2022 = 0;
int cnteucj = 0;
int cntsjis = 0;
int cntBAD = 0;
for (char c = '\u0000'; c < '\uffff'; c++) {
if (c == '\u001b' || // ESC
c == '\u2014') // Em-Dash?
continue;
String s = new String (new char[] {c});
//----------------------------------------------------------------
// JISAutoDetect can handle all chars that EUC-JP can,
// unless there is an ambiguity with SJIS.
//----------------------------------------------------------------
byte[] beucj = s.getBytes(EUCJ);
String seucj = new String(beucj, EUCJ);
if (seucj.equals(s)) {
cnteucj++;
String sauto = new String(beucj, "JISAutoDetect");
if (! sauto.equals(seucj)) {
cntBAD++;
String ssjis = new String(beucj, SJIS);
if (! sauto.equals(ssjis)) {
fail("Autodetection agrees with neither EUC nor SJIS");
}
}
} else
continue; // Optimization
//----------------------------------------------------------------
// JISAutoDetect can handle all chars that ISO-2022-JP can.
//----------------------------------------------------------------
byte[] b2022 = s.getBytes("ISO-2022-JP");
if (new String(b2022, "ISO-2022-JP").equals(s)) {
cnt2022++;
check(new String(b2022,"JISAutoDetect").equals(s),
"ISO2022 autodetection");
}
//----------------------------------------------------------------
// JISAutoDetect can handle almost all chars that SJIS can.
//----------------------------------------------------------------
byte[] bsjis = s.getBytes(SJIS);
if (new String(bsjis, SJIS).equals(s)) {
cntsjis++;
check(new String(bsjis,"JISAutoDetect").equals(s),
"SJIS autodetection");
}
}
out.printf("There are %d ISO-2022-JP-encodable characters.%n", cnt2022);
out.printf("There are %d SJIS-encodable characters.%n", cntsjis);
out.printf("There are %d EUC-JP-encodable characters.%n", cnteucj);
out.printf("There are %d characters that are " +
"misdetected as SJIS after being EUC-encoded.%n", cntBAD);
//----------------------------------------------------------------
// tests for specific byte sequences
//----------------------------------------------------------------
test("ISO-2022-JP", new byte[] {'A', 'B', 'C'});
test("EUC-JP", new byte[] {'A', 'B', 'C'});
test("SJIS", new byte[] {'A', 'B', 'C'});
test("SJIS",
new byte[] { 'C', 'o', 'p', 'y', 'r', 'i', 'g', 'h', 't',
' ', (byte)0xa9, ' ', '1', '9', '9', '8' });
test("SJIS",
new byte[] { (byte)0xbb, (byte)0xdd, (byte)0xcf, (byte)0xb2,
(byte)0xb8, (byte)0xdb, (byte)0xbc, (byte)0xbd,
(byte)0xc3, (byte)0xd1, (byte)0xbd, (byte)0xde,
(byte)0x82, (byte)0xc5, (byte)0x82, (byte)0xb7 });
test("EUC-JP",
new byte[] { (byte)0xa4, (byte)0xd2, (byte)0xa4, (byte)0xe9,
(byte)0xa4, (byte)0xac, (byte)0xa4, (byte)0xca });
test("SJIS",
new byte[] { (byte)0xbb, (byte)0xdd, (byte)0xcf, (byte)0xb2,
(byte)0xb8, (byte)0xdb, (byte)0xbc, (byte)0xbd,
(byte)0xc3, (byte)0xd1, (byte)0xbd, (byte)0xde});
test("SJIS",
new byte[] { (byte)0xbb, (byte)0xdd, (byte)0xcf, (byte)0xb2,
(byte)0xb8, (byte)0xdb, (byte)0xbc, (byte)0xbd,
(byte)0xc3, (byte)0xd1, (byte)0xbd });
test("SJIS",
new byte[] { (byte)0x8f, (byte)0xa1, (byte)0xaa });
test("EUC-JP",
new byte[] { (byte)0x8f, (byte)0xc5, (byte)0xe0, (byte)0x20});
test("EUC-JP",
new byte[] { (byte)0xbb, (byte)0xdd, (byte)0xcf, (byte)0xb2,
(byte)0xb8, (byte)0xdb, (byte)0xbc, (byte)0xbd,
(byte)0xc3, (byte)0xd1, (byte)0xbd, (byte)0xde,
(byte)0xa4, (byte)0xc7, (byte)0xa4, (byte)0xb9 });
test("ISO-2022-JP",
new byte[] { 0x1b, '$', 'B', '#', '4', '$', '5', 0x1b, '(', 'B' });
//----------------------------------------------------------------
// Check handling of ambiguous end-of-input in middle of first char
//----------------------------------------------------------------
{
CharsetDecoder dc = Charset.forName("x-JISAutoDetect").newDecoder();
ByteBuffer bb = ByteBuffer.allocate(128);
CharBuffer cb = CharBuffer.allocate(128);
bb.put((byte)'A').put((byte)0x8f);
bb.flip();
CoderResult res = dc.decode(bb,cb,false);
check(res.isUnderflow(), "isUnderflow");
check(bb.position() == 1, "bb.position()");
check(cb.position() == 1, "cb.position()");
res = dc.decode(bb,cb,false);
check(res.isUnderflow(), "isUnderflow");
check(bb.position() == 1, "bb.position()");
check(cb.position() == 1, "cb.position()");
bb.compact();
bb.put((byte)0xa1);
bb.flip();
res = dc.decode(bb,cb,true);
check(res.isUnderflow(), "isUnderflow");
check(bb.position() == 2, "bb.position()");
check(cb.position() == 2, "cb.position()");
}
if (failures > 0)
throw new RuntimeException(failures + " tests failed");
}
static void checkCoderResult(CoderResult result) {
check(result.isUnderflow(),
"Unexpected coder result: " + result);
}
static void test(String expectedCharset, byte[] input) throws Exception {
Charset cs = Charset.forName("x-JISAutoDetect");
CharsetDecoder autoDetect = cs.newDecoder();
Charset cs2 = Charset.forName(expectedCharset);
CharsetDecoder decoder = cs2.newDecoder();
ByteBuffer bb = ByteBuffer.allocate(128);
CharBuffer charOutput = CharBuffer.allocate(128);
CharBuffer charExpected = CharBuffer.allocate(128);
bb.put(input);
bb.flip();
bb.mark();
CoderResult result = autoDetect.decode(bb, charOutput, true);
checkCoderResult(result);
charOutput.flip();
String actual = charOutput.toString();
bb.reset();
result = decoder.decode(bb, charExpected, true);
checkCoderResult(result);
charExpected.flip();
String expected = charExpected.toString();
check(actual.equals(expected),
String.format("actual=%s expected=%s", actual, expected));
}
}

View File

@ -0,0 +1,58 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
* @summary Verify that if InputStream.read returns 0 we throw an exception.
* @bug 4684515
*/
import java.io.*;
public class ReadZero {
public static void main(String [] args) throws IOException {
ReadZero r = new ReadZero();
r.testInputStream();
}
private void testInputStream() throws IOException {
File f = new File(System.getProperty("test.src", "."), "ReadZero.java");
InputStream is = new FileInputStream(f) {
public int read(byte [] b, int off, int len) {
System.out.println("FileInputStream.read");
return 0;
}
};
is.read(new byte[1], 0, 1); // ok
InputStreamReader isr = new InputStreamReader(is);
try {
int res = isr.read(new char[1], 0, 1);
} catch (IOException x) {
System.out.println("IOException caught");
return;
}
throw new RuntimeException("IOException not thrown");
}
}

View File

@ -0,0 +1,73 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4913702
@summary validates canEncode(char c) method for sun.nio.cs.Shift_JIS
*/
import java.nio.*;
import java.nio.charset.*;
public class SJISCanEncode {
private Charset cs;
private CharsetEncoder encoder;
private void canEncodeTest(char inputChar,
boolean expectedResult)
throws Exception {
String msg = "err: Shift_JIS canEncode() return value ";
if (encoder.canEncode(inputChar) != expectedResult) {
throw new Exception(msg + !(expectedResult) +
": " + Integer.toHexString((int)inputChar));
}
}
public static void main(String[] args) throws Exception {
SJISCanEncode test = new SJISCanEncode();
test.cs = Charset.forName("SJIS");
test.encoder = test.cs.newEncoder();
// us-ascii (mappable by Shift_JIS)
test.canEncodeTest('\u0001', true);
// Halfwidth Katakana
test.canEncodeTest('\uFF01', true);
// CJK ideograph
test.canEncodeTest('\u4E9C', true);
//Hiragana
test.canEncodeTest('\u3041', true);
// fullwidth Katakana
test.canEncodeTest('\u30A1', true);
// U+0080 should be unmappable
// U+4000 is a BMP character not covered by Shift_JISe
test.canEncodeTest('\u0080', false);
test.canEncodeTest('\u4000', false);
}
}

View File

@ -0,0 +1,76 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 5005426
@summary Check if StreamEncoder close() method works correctly from
error recovery after the underneath OutputStream failed to
close the first time.
*/
import java.io.*;
public class StreamEncoderClose {
public static void main( String arg[] ) throws Exception {
byte[] expected = {(byte)0x1b,(byte)0x24,(byte)0x42,
(byte)0x30,(byte)0x6c,
(byte)0x1b,(byte)0x28,(byte)0x42};
ByteArrayOutputStream baos = new ByteArrayOutputStream();
MyBufferedOutputStream mbos = new MyBufferedOutputStream(baos);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(mbos, "ISO-2022-JP"));
mbos.dontClose();
pw.write("\u4e00");
pw.close(); // 1st PrintWriter Close
mbos.canClose();
pw.close(); // 2nd PrintWriter Close
//double check, probably not necessary
byte[] out = baos.toByteArray();
if (out.length != expected.length) {
throw new IOException("Failed");
}
for (int i = 0; i < out.length; i++) {
//System.out.printf("(byte)0x%x,", out[i] & 0xff);
if (out[i] != expected[i])
throw new IOException("Failed");
}
}
static class MyBufferedOutputStream extends BufferedOutputStream {
MyBufferedOutputStream(OutputStream os) {
super(os);
}
private boolean status;
public void dontClose() {
status = false;
}
public void canClose() {
status = true;
}
public void close() throws IOException {
if ( status == false ) {
throw new IOException("Can't close ");
}
super.close();
}
}
}

View File

@ -0,0 +1,121 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4896454
@summary Check GB18030 surrogate encoding/decoding handling
*/
import java.nio.*;
import java.nio.charset.*;
public class SurrogateGB18030Test {
public static void main(String[] args) throws Exception {
SurrogateGB18030Test test = new SurrogateGB18030Test();
test.roundtripTest();
/**
* Valid Surrogate pair and 4 byte GB18030 representation
*/
String inputString = "\uD800\uDC00";
byte[] expectedBytes = { (byte)0x90,
(byte)0x30,
(byte)0x81,
(byte)0x30
};
test.encodeTest(inputString, expectedBytes);
/**
* Vice-versa : check that 4 byte GB18030 value encodes correctly
*/
String expectedStr = "\uDBFF\uDFFF";
byte[] inputBytes = { (byte)0xe3,
(byte)0x32,
(byte)0x9a,
(byte)0x35
};
test.decodeTest(inputBytes, expectedStr);
}
private void roundtripTest() throws Exception
{
byte[] ba;
char[] pair = new char[2];
for (char high = '\ud800'; high <= '\udbff'; high++) {
for (char low = '\udc00'; low <= '\udfff'; low++) {
pair[0] = high;
pair[1] = low;
String s = new String(pair);
if (!s.equals(new String(s.getBytes("gb18030"), "gb18030")))
throw new Exception ("GB18030 roundtrip failure");
}
}
}
private void encodeTest(String inputString, byte[] expectedBytes)
throws Exception
{
byte[] encoded = inputString.getBytes("GB18030");
CharBuffer cb = CharBuffer.wrap(inputString.toCharArray());
ByteBuffer bb = ByteBuffer.allocate(4);
CharsetEncoder encoder = Charset.forName("GB18030").newEncoder();
encoder.encode(cb, bb, true);
bb.flip();
for (int i = 0 ; i < expectedBytes.length; i++) {
if (encoded[i] != expectedBytes[i]
|| bb.get() != expectedBytes[i])
throw new Exception ("GB18030 encode failure");
}
}
private void decodeTest(byte[] inputBytes, String expectedStr)
throws Exception
{
String s2 = new String(inputBytes, "GB18030");
CharsetDecoder decoder = Charset.forName("GB18030").newDecoder();
ByteBuffer bb = ByteBuffer.wrap(inputBytes);
CharBuffer cb = CharBuffer.allocate(2);
decoder.decode(bb, cb, true);
cb.flip();
for (int i = 0 ; i < expectedStr.length(); i++) {
if (expectedStr.charAt(i) != cb.get()
|| s2.charAt(i) != expectedStr.charAt(i))
throw new Exception ("GB18030 encode failure");
}
}
}

View File

@ -0,0 +1,95 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4847097
@summary Check surrogate coverage of EUC_TW
*/
/*
* Tests the full surrogate mapping roundtrip fidelity of the
* EUC-TW charset coder updated to support the additional
* planes 4,5,6,7,15
*
* byte->char mappings are contained in external files
* using plane{x}.surrogate as the convention for the input filenames
*
*/
import java.io.*;
public class SurrogateTestEUCTW {
private static final String testRootDir
= System.getProperty("test.src", ".");
public static void main(String[] args) throws Exception {
char[] surrogatePair = new char[2];
int[] expectBytes = new int[4];
// Iterate test over each supported CNS-11643 plane
// containing supplementary character mappings
String[] testPlane = { "3", "4", "5", "6" ,"7", "15" };
for (int i = 0 ; i < testPlane.length; i++) {
FileReader f = new FileReader(testRootDir +
System.getProperty("file.separator")
+ "SurrogateTestEUCTW.plane"
+ testPlane[i]
+ ".surrogates");
BufferedReader r = new BufferedReader(f);
String line;
while ((line = r.readLine()) != null) {
int charValue = Integer.parseInt(line.substring(9,14), 16);
surrogatePair[0] = (char) ((charValue - 0x10000) / 0x400
+ 0xd800);
surrogatePair[1] = (char) ((charValue - 0x10000) % 0x400
+ 0xdc00);
// Synthesize 4 byte expected byte values from CNS input values
expectBytes[0] = 0x8E;
expectBytes[1] = 0xA0 + Integer.parseInt(testPlane[i]);
expectBytes[2] = 0x80 | Integer.parseInt(line.substring(2,4), 16);
expectBytes[3] = 0x80 | Integer.parseInt(line.substring(4,6), 16);
String testStr = new String(surrogatePair);
byte[] encodedBytes = testStr.getBytes("EUC-TW");
for (int x = 0 ; x < 4 ; x++) {
if (encodedBytes[x] != (byte)(expectBytes[x] & 0xff)) {
throw new Exception("EUC_TW Surrogate Encoder error");
}
}
// Next: test round-trip fidelity
String decoded = new String(encodedBytes, "EUC-TW");
if (!decoded.equals(testStr)) {
throw new Exception("EUCTW Decoder error");
}
}
r.close();
f.close();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,71 @@
0x2144 0x2000B
0x214F 0x2F817
0x216F 0x201A9
0x217C 0x2F850
0x2225 0x2F82A
0x227B 0x2F815
0x2329 0x2F82C
0x233C 0x2F83B
0x2359 0x21D46
0x2424 0x23C86
0x2429 0x2F835
0x2441 0x2F81B
0x2452 0x2F80E
0x257E 0x225D7
0x2627 0x2F8B2
0x272A 0x2F98F
0x274E 0x20209
0x2753 0x2F80F
0x2754 0x2F811
0x275C 0x206EC
0x2A39 0x2233F
0x2A45 0x2592E
0x2C40 0x2F87A
0x2C51 0x2F899
0x2D35 0x2F8DF
0x2D52 0x2F8FE
0x2E56 0x2F96A
0x2E5A 0x25133
0x3023 0x2F841
0x3053 0x2172E
0x315C 0x2F8E1
0x3350 0x2F983
0x3460 0x20DAE
0x3470 0x2F855
0x347E 0x21637
0x355F 0x2F88D
0x3565 0x2F89C
0x3628 0x2F8BA
0x3640 0x2F8CB
0x3675 0x2F907
0x3977 0x20564
0x3A26 0x2F833
0x3A4F 0x21364
0x3C3A 0x2F8E5
0x3D3F 0x2F934
0x3F6D 0x28CDD
0x4043 0x2F823
0x407E 0x2F87E
0x416E 0x2F8E8
0x4333 0x2F94E
0x4425 0x2F98D
0x446D 0x2F9DB
0x4670 0x2F8A6
0x4731 0x230BA
0x474B 0x235F3
0x4826 0x24A0F
0x486A 0x2F96C
0x5039 0x20B89
0x5460 0x2F8AF
0x553A 0x24039
0x5545 0x2F921
0x5678 0x2F9F5
0x5736 0x29937
0x584F 0x25CD1
0x5863 0x265DF
0x5A33 0x2F86A
0x5A36 0x2F870
0x5B26 0x2F9B6
0x5B2D 0x2F9C1
0x5C2F 0x2FA19
0x607C 0x2F9D6

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
#
# Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# @test
# @bug 4200310
# @summary make sure class files are not duplicated between rt.jar,
# charsets.jar, and localedata.jar
# @author Norbert Lindenberg
# @run shell Test4200310.sh
2>1 $TESTJAVA/bin/jar -tf "$TESTJAVA/jre/lib/rt.jar" > class-list
2>1 $TESTJAVA/bin/jar -tf "$TESTJAVA/jre/lib/charsets.jar" >> class-list
2>1 $TESTJAVA/bin/jar -tf "$TESTJAVA/jre/lib/ext/localedata.jar" >> class-list
duplicates=`grep '\.class$' class-list | sort | uniq -d`
rm -f class-list
if [ "$duplicates" != "" ]; then
echo FAILED: $duplicates are duplicated between rt.jar, charsets.jar, and localedata.jar
exit 1
fi
exit 0

View File

@ -0,0 +1,38 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4206507
@summary verify that we can obtain and use a converter for encoding
ISO8859-9 in the Turkish locale.
*/
import java.util.Locale;
import java.io.UnsupportedEncodingException;
public class Test4206507 {
public static void main(String[] args) throws UnsupportedEncodingException {
Locale.setDefault(new Locale("tr", "TR"));
byte[] b = "".getBytes("ISO8859-9");
}
}

View File

@ -0,0 +1,38 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 6254467
@summary Checks if Charset.forName() accepts legal IANA alias names
for charset IBM037.
*/
import java.nio.charset.Charset;
public class Test6254467 {
public static void main (String[] args) throws Exception {
Charset ebcdic = Charset.forName("ebcdic-cp-us");
ebcdic = Charset.forName("ebcdic-cp-ca");
ebcdic = Charset.forName("ebcdic-cp-wt");
ebcdic = Charset.forName("ebcdic-cp-nl");
}
}

View File

@ -0,0 +1,42 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 6275027
@summary Check if StreamEncoder works correctly when fed with unpaired
surrogates.
*/
import java.io.*;
public class Test6275027 {
public static void main( String arg[] ) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
ps.print("\uda00");
ps.print("\uda01");
ps.close();
if (!"??".equals(baos.toString()))
throw new Exception("failed");
}
}

View File

@ -0,0 +1,59 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
@bug 6392804
@summary Decoder fails to detect decoding error
*/
import java.nio.*;
import java.nio.charset.*;
public class Test6392804 {
public static void main(String[] args) throws Throwable {
test("ISO-2022-JP",
new byte[] {0x1b,(byte)0x8e, 0x24, 0x40, 0x0, 0x0});
test("ISO-2022-JP-2",
new byte[] {0x1b,(byte)0x8e, 0x24, 0x40, 0x0, 0x0});
test("x-windows-50220",
new byte[] {0x1b,(byte)0x8e, 0x24, 0x40, 0x0, 0x0});
test("x-windows-50221",
new byte[] {0x1b,(byte)0x8e, 0x24, 0x40, 0x0, 0x0});
test("x-windows-iso2022jp",
new byte[] {0x1b,(byte)0x8e, 0x24, 0x40, 0x0, 0x0});
test("EUC_TW",
new byte[] {(byte)0x8e, (byte)0xa8, (byte)0xad, (byte)0xe5});
//out of range second byte
test("EUC_TW",
new byte[] {(byte)0x8e, (byte)0x92, (byte)0xa1, (byte)0xa1});
test("EUC_TW",
new byte[] {(byte)0x8e, (byte)0x98, (byte)0xa1, (byte)0xa1});
}
static void test(String csn, byte[] bytes) throws Throwable {
CharsetDecoder dec = Charset.forName(csn).newDecoder();
CharBuffer cb = CharBuffer.allocate(1024);
CoderResult cr = dec.decode(ByteBuffer.wrap(bytes), cb, true);
if (cr.isUnderflow())
throw new RuntimeException(csn + " failed cr=" + cr);
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
* @bug 6427981
* @summary Check the Compound_Text's canonical name and its aliases
*/
import java.nio.charset.*;
import java.util.Set;
public class TestCompoundTest {
public static void main(String args[]) throws Exception
{
if (System.getProperty("os.name").startsWith("Windows"))
return;
Charset cs = Charset.forName("COMPOUND_TEXT");
if (!cs.name().startsWith("x-"))
throw new RuntimeException("FAILED: name does not start with x-");
Set<String> aliases = cs.aliases();
if (!aliases.contains("COMPOUND_TEXT") ||
!aliases.contains("x-compound-text") ||
!aliases.contains("x11-compound_text"))
throw new RuntimeException("FAILED: alias name is missing");
}
}

View File

@ -0,0 +1,92 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4122961
@summary Verify that converters don't drop characters on buffer boundaries
This is a slightly modified version of the attachment supplied with the
bug report.
*/
import java.io.*;
public class TestConverterDroppedCharacters {
public static void main(String args[])
throws java.io.IOException, java.io.UnsupportedEncodingException,
java.io.FileNotFoundException
{
/* Try misc. encodings, many are broken. */
tryEncoding("Big5");
tryEncoding("CNS11643");
tryEncoding("Cp1006");
tryEncoding("Cp1381");
tryEncoding("Cp33722");
tryEncoding("GB2312");
tryEncoding("KSC5601");
tryEncoding("SJIS");
tryEncoding("UTF8");
}
static void tryEncoding(String encoding)
throws java.io.IOException, java.io.UnsupportedEncodingException,
java.io.FileNotFoundException
{
String filename = "OUTPUT";
int goesBadAfter = 8193;
int i;
char data[] = new char[goesBadAfter+1];
System.out.println("Testing " + encoding);
/* Create some data */
for(i = 0; i < goesBadAfter; i++) {
data[i] = (char)((i % 0x7f) + 1);
}
/* Write the data out to a file. */
FileOutputStream fout = new FileOutputStream(filename);
OutputStreamWriter ow = new OutputStreamWriter(fout, encoding);
BufferedWriter fd = new BufferedWriter(ow);
fd.write(data,0,goesBadAfter);
fd.close();
/* Now read it back with the same encoding. */
char buf[] = new char[goesBadAfter+1];
FileInputStream fin = new FileInputStream("OUTPUT");
InputStreamReader ir = new InputStreamReader(fin, encoding);
ir.read(buf,0,goesBadAfter);
ir.close();
/* And check to see if what we wrote is what we got back. */
for(i = 0; i < goesBadAfter; i++) {
if (data[i] != buf[i]) {
System.out.println("ERROR with encoding " + encoding
+ ": Data wrong at position " + i + " "
+ "in: " + (int)data[i] + " "
+ "out: " + (int)buf[i]);
throw new RuntimeException();
}
}
System.out.println("Successfully tested " + encoding);
}
}

View File

@ -0,0 +1,101 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 6379808
@summary Check all Cp933 SBCS characters are not supported in Cp834
*/
import sun.io.*;
import java.io.*;
import java.nio.*;
import java.nio.charset.*;
public class TestCp834_SBCS {
public static void main(String args[]) throws Exception {
// The correctness of 1:1 mapping is Coverted by CoderTest.java
// and TestConv.java, we only need to verify that SBCS characters
// are not supported by this charset.
CharToByteConverter cb834 = CharToByteConverter.getConverter("Cp834");
ByteToCharConverter bc834 = ByteToCharConverter.getConverter("Cp834");
CharsetEncoder enc834 = Charset.forName("Cp834")
.newEncoder()
.onUnmappableCharacter(CodingErrorAction.REPLACE)
.onMalformedInput(CodingErrorAction.REPLACE);
CharsetDecoder dec834 = Charset.forName("Cp834")
.newDecoder()
.onUnmappableCharacter(CodingErrorAction.REPLACE)
.onMalformedInput(CodingErrorAction.REPLACE);
CharsetDecoder dec933 = Charset.forName("Cp933")
.newDecoder()
.onUnmappableCharacter(CodingErrorAction.REPLACE)
.onMalformedInput(CodingErrorAction.REPLACE);
byte[] ba = new byte[1];
byte[] ba2 = new byte[2];
ByteBuffer dbb = ByteBuffer.allocateDirect(10);
char[] ca = new char[1];
char c;
for (int i = 0; i <= 0xff; i++) {
if (i != 0xe && i != 0xf) { // no SI/SO
ba[0] = (byte)i;
CharBuffer cb = dec933.decode(ByteBuffer.wrap(ba));
if ((c = cb.get()) != '\ufffd') {
// OK, this is a SBCS character in Cp933
if (dec834.decode(ByteBuffer.wrap(ba)).get() != '\ufffd')
throw new Exception("SBCS is supported in IBM834 decoder");
if (enc834.canEncode(c))
throw new Exception("SBCS can be encoded in IBM834 encoder");
ca[0] = c;
ByteBuffer bb = enc834.encode(CharBuffer.wrap(ca));
if (bb.get() != (byte)0xfe || bb.get() != (byte)0xfe)
throw new Exception("SBCS is supported in IBM834 encoder");
boolean isMalformed = false;
int ret = 0;
bc834.reset();
try {
ret = bc834.convert(ba, 0, 1, ca, 0, 1);
} catch (sun.io.MalformedInputException x) { isMalformed = true; }
if (!isMalformed && ret != 0 && ca[0] != '\ufffd') {
// three scenarios (1)malformed (2)held as an incomplete
// input or (3)return replacement all mean "no sbcs"
throw new Exception("SBCS is supported in Cp834 b2c");
}
if (cb834.canConvert(c))
throw new Exception("SBCS can be converted in Cp834 c2b ");
ca[0] = c;
if (cb834.convert(ca, 0, 1, ba2, 0, 2) != 2 ||
ba2[0] != (byte)0xfe || ba2[1] != (byte)0xfe) {
throw new Exception("SBCS is supported in Cp834 c2b");
}
}
}
}
}
}

View File

@ -0,0 +1,52 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4429358
@summary Remove illegal SI/SO char to byte mappings
*/
public class TestCp93xSISO {
public static void main ( String[] args) throws Exception {
int exceptionCount = 0;
String[] encName = {"Cp930", "Cp933", "Cp935", "Cp937", "Cp939" };
String s = "\u000e\u000f" ;
for ( int i=0; i < encName.length; i++) { // Test 2 converters.
try {
byte[] encoded = s.getBytes(encName[i]);
for (int j=0 ; j<encoded.length; j++) {
if (encoded[j] != (byte)0x6f) // Expect to map to 0x6f
exceptionCount++;
}
} catch (Throwable t) {
System.err.println("error with converter " + encName[i]);
exceptionCount++;
}
}
if (exceptionCount > 0)
throw new Exception ("bug4429369: Cp93x SI/SO Ch->Byte mappings incorrect");
}
}

View File

@ -0,0 +1,146 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 6371437 6371422 6371416 6371619 5058184 6371431
@summary Check if the problems reported in above bugs have been fixed
*/
import java.io.*;
import java.nio.*;
import java.nio.charset.*;
public class TestIBMBugs {
private static void bug6371437() throws Exception {
CharsetEncoder converter = Charset.forName("Cp933").newEncoder();
converter = converter.onMalformedInput(CodingErrorAction.REPORT);
converter = converter.onUnmappableCharacter(CodingErrorAction.REPORT);
CharBuffer in = CharBuffer.wrap(new char[] { (char)4352 });
try {
ByteBuffer out = converter.encode(in);
} catch (CharacterCodingException e) { }
}
private static void bug6371422() throws Exception {
String[] charsets = { "Cp949", "Cp949C" };
for (int n = 0; n < charsets.length; n++) {
String charset = charsets[n];
CharsetEncoder converter = Charset.forName(charset).newEncoder();
converter = converter.onMalformedInput(CodingErrorAction.REPORT);
converter = converter.onUnmappableCharacter(CodingErrorAction.REPORT);
int errors = 0;
for (int i = 1; i < 0x1ffff; i++) {
if (i >= 0x1100 && i <= 0x11f9)
continue; //Dont try leading consonant, vowel and trailing
//consonant as a single char
char[] in = (i < 0x10000
? new char[] { (char)i }
: new char[] { (char)(0xd800 + ((i - 0x10000) >> 10)),
(char)(0xdc00 + ((i - 0x10000) & 0x3ff)) });
try {
ByteBuffer out = converter.encode(CharBuffer.wrap(in));
if (out.remaining() == 0 ||
(out.remaining() == 1 && out.get(0) == 0x00)) {
errors++;
}
} catch (CharacterCodingException e) { }
}
if (errors > 0)
throw new Exception("Charset "+charset+": "+errors+" errors");
}
}
private static void bug6371416() throws Exception {
String[] charsets = { "Cp933", "Cp949", "Cp949C", "Cp970"};
for (int n = 0; n < charsets.length; n++) {
String charset = charsets[n];
CharsetEncoder converter = Charset.forName(charset).newEncoder();
converter = converter.onMalformedInput(CodingErrorAction.REPORT);
converter = converter.onUnmappableCharacter(CodingErrorAction.REPORT);
int errors = 0;
for (int i = 0xd800; i < 0xe000; i++) {
char[] in = new char[] { (char)i };
try {
ByteBuffer out = converter.encode(CharBuffer.wrap(in));
if (out.remaining() == 0)
errors++;
} catch (CharacterCodingException e) { }
}
if (errors > 0)
throw new Exception("Charset "+charset+": "+errors+" errors");
}
}
private static void bug6371619() throws Exception {
String encoding = "Cp964";
Charset charset = Charset.forName(encoding);
CharsetDecoder converter = charset.newDecoder();
converter = converter.onMalformedInput(CodingErrorAction.REPORT);
converter = converter.onUnmappableCharacter(CodingErrorAction.REPORT);
int errors = 0;
for (int b = 0x80; b < 0x100; b++)
if (!(b == 0x8e || // 0x8e is a SS2
(b >= 0x80 && b <= 0x8d) || (b >= 0x90 && b <= 0x9f))) {
ByteBuffer in = ByteBuffer.wrap(new byte[] { (byte)b });
try {
CharBuffer out = converter.decode(in);
if (out.length() == 0) {
errors++;
}
} catch (CharacterCodingException e) { }
}
if (errors > 0)
throw new Exception("Charset "+charset+": "+errors+" errors");
}
private static void bug6371431() throws Exception {
String encoding = "Cp33722";
Charset charset = Charset.forName(encoding);
CharsetDecoder converter = charset.newDecoder();
converter = converter.onMalformedInput(CodingErrorAction.REPORT);
converter = converter.onUnmappableCharacter(CodingErrorAction.REPORT);
int errors = 0;
for (int b = 0xa0; b < 0x100; b++) {
ByteBuffer in = ByteBuffer.wrap(new byte[] { (byte)b });
try {
CharBuffer out = converter.decode(in);
if (out.length() == 0) {
errors++;
}
} catch (CharacterCodingException e) { }
}
if (errors > 0)
throw new Exception("Charset "+charset+": "+errors+" errors");
}
public static void main (String[] args) throws Exception {
bug6371437();
bug6371422();
bug6371416();
bug6371619();
bug6371431();
}
}

View File

@ -0,0 +1,71 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 6431650
@summary Check charset ISCII91 and C2B/B2CISCII91 yield same encoding/decoding result
*/
import java.nio.*;
import java.nio.charset.*;
import sun.io.*;
public class TestISCII91 {
public static void main(String[] args) throws Throwable{
CharToByteConverter c2b = new CharToByteISCII91();
ByteToCharConverter b2c = new ByteToCharISCII91();
Charset cs = Charset.forName("ISCII91");
String charsToEncode = getCharsForEncoding("ISCII91");
byte [] c2bBytes = c2b.convertAll(charsToEncode.toCharArray());
byte [] csBytes = cs.encode(charsToEncode).array();
for (int i = 0; i < c2bBytes.length; ++i) {
if (c2bBytes[i] != csBytes[i])
throw new RuntimeException("ISCII91 encoding failed!");
}
char[] c2bChars = b2c.convertAll(c2bBytes);
char[] csChars = cs.decode(ByteBuffer.wrap(csBytes)).array();
for (int i = 0; i < c2bChars.length; ++i) {
if (c2bChars[i] != csChars[i])
throw new RuntimeException("ISCII91 decoding failed!");
}
}
static String getCharsForEncoding(String encodingName)
throws CharacterCodingException{
Charset set = Charset.forName(encodingName);
CharBuffer chars = CharBuffer.allocate(300);
CharsetEncoder encoder = set.newEncoder();
for (int c = 0; chars.remaining() > 0 && c < Character.MAX_VALUE; ++c) {
if (Character.isDefined((char) c) && !Character.isISOControl((char) c) && encoder.canEncode((char) c)) {
chars.put((char) c);
}
}
chars.limit(chars.position());
chars.rewind();
return chars.toString();
}
}

View File

@ -0,0 +1,440 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4779029 4924625 6392664
@summary Test decoding of various permutations of valid ISO-2022-CN byte sequences
*/
/*
* Regression test for NIO ISO-2022-CN decoder. Passes various valid
* ISO-2022-CN byte sequences to the decoder using the java.io
* InputStreamReader API
*/
import java.io.*;
import java.nio.*;
import java.nio.charset.*;
public class TestISO2022CNDecoder
{
private static String encodingName = "ISO2022CN";
//
// Positive tests -- test both output and input processing against
// various "known good" data
//
private static boolean decodeTest (
byte encoded[],
char decoded[],
String label)
{
boolean retval = true;
int i = 0;
try {
//
// Ensure that reading decodes correctly
//
ByteArrayInputStream in;
InputStreamReader reader;
in = new ByteArrayInputStream(encoded);
reader = new InputStreamReader(in, encodingName);
for (i = 0; i < decoded.length; i++) {
int c = reader.read();
if (c != decoded[i]) {
System.err.print(label + ": read failed, char " + i);
System.err.print(" ... expected 0x"
+ Integer.toHexString(decoded[i]));
if (c == -1)
System.err.println(", got EOF");
else
System.err.println(", got 0x"
+ Integer.toHexString(c));
retval = false;
if (c == -1)
return retval;
}
}
int testChar;
if ((testChar = reader.read()) != -1) {
System.err.println(label + ": read failed, no EOF");
System.err.println("testChar is " +
Integer.toHexString((int)testChar));
return false;
}
String decodedString = new String(encoded, "ISO2022CN");
for (i = 0; i < decodedString.length(); i++) {
if (decodedString.charAt(i) != decoded[i])
System.err.println(label + ": read failed, char " + i);
}
CharsetDecoder dec = Charset.forName("ISO2022CN")
.newDecoder()
.onUnmappableCharacter(CodingErrorAction.REPLACE)
.onMalformedInput(CodingErrorAction.REPLACE);
ByteBuffer bb = ByteBuffer.allocateDirect(encoded.length).put(encoded);
bb.flip();
CharBuffer cb = ByteBuffer.allocateDirect(2*encoded.length*(int)dec.maxCharsPerByte())
.asCharBuffer();
if (bb.hasArray() || cb.hasArray()) {
System.err.println(label + ": directBuffer failed, ");
return false;
}
if (!dec.decode(bb, cb, true).isUnderflow()) {
System.err.println(label + ": decoder's decode() failed!");
return false;
}
cb.flip();
for (i = 0; i < cb.limit(); i++) {
if (cb.get() != decoded[i])
System.err.println(label + ": decoder failed, char " + i);
}
} catch (Exception e) {
System.err.println(label + ": failed "
+ "(i = " + i + "), "
+ e.getClass().getName()
+ ", " + e.getMessage());
e.printStackTrace();
return false;
}
return retval;
}
private static boolean equal(CoderResult a, CoderResult b) {
return (a == CoderResult.OVERFLOW && b == CoderResult.OVERFLOW) ||
(a == CoderResult.UNDERFLOW && b == CoderResult.UNDERFLOW) ||
((a.isError() == b.isError()) &&
(a.isMalformed() == b.isMalformed()) &&
(a.isUnmappable() == b.isUnmappable()) &&
(a.length() == b.length()));
}
private static boolean decodeResultTest (byte encoded[],
CoderResult expected,
String label) {
CharsetDecoder dec = Charset.forName("ISO2022CN").newDecoder();
ByteBuffer bb = ByteBuffer.wrap(encoded);
CharBuffer cb = CharBuffer.allocate(encoded.length*(int)dec.maxCharsPerByte());
CoderResult result = dec.decode(bb, cb, true);
if (!equal(result, expected)) {
System.err.println(label + ": decoder's decode() failed!");
return false;
}
bb = ByteBuffer.allocateDirect(encoded.length).put(encoded);
bb.flip();
cb = ByteBuffer.allocateDirect(2*encoded.length*(int)dec.maxCharsPerByte())
.asCharBuffer();
if (bb.hasArray() || cb.hasArray()) {
System.err.println(label + ": directBuffer failed, ");
return false;
}
result = dec.reset().decode(bb, cb, true);
if (!equal(result, expected)) {
System.err.println(label + ": decoder's decode() - direct failed!");
return false;
}
return true;
}
//
// Negative tests -- only for input processing, make sure that
// invalid or corrupt characters are rejected.
//
private static boolean negative (byte encoded [], String label)
{
try {
ByteArrayInputStream in;
InputStreamReader reader;
int c;
in = new ByteArrayInputStream(encoded);
reader = new InputStreamReader(in, encodingName);
c = reader.read();
System.err.print (label + ": read failed, ");
if (c == -1)
System.err.println("reported EOF");
else
System.err.println("returned char 0x"
+ Integer.toHexString(c)
+ ", expected exception");
return false;
} catch (CharConversionException e) {
return true;
} catch (Throwable t) {
System.err.println(label + ": failed, threw "
+ t.getClass().getName()
+ ", " + t.getMessage());
}
return false;
}
private static boolean decodeTest6392664 () {
try {
CharsetDecoder dec = Charset.forName("ISO-2022-CN-GB").newDecoder();
dec.decode(ByteBuffer.wrap(new byte[] {(byte)0x0e, (byte)0x42, (byte)0x43 }));
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
//
// TEST #0: 7-bit unshifted values,
// shift-in of a valid decodable GB2312-80
// character and an unmappable GB2312-80 char
// This is a positive test.
//
private static byte test0_bytes[] = {
(byte)0x00,
(byte)0x01, (byte)0x02, (byte)0x03,
(byte)0x0E, (byte)0x21, (byte)0x2f,
(byte)0x0E, (byte)0xDD, (byte)0x9f
};
private static char test0_chars[] = {
0x0000,
0x0001, 0x0002, 0x0003,
0x2019,
0xFFFD
};
private static byte test1_bytes[] = {
(byte)0x1b, (byte)0x24, (byte)0x29, (byte)0x41, (byte)0x21,
(byte)0x2f };
private static char test1_chars[] = {
0x21, 0x2f
};
private static byte test2_bytes[] = {
(byte)0x0e,
(byte)0x1b, (byte)0x24, (byte)0x29, (byte)0x41,
(byte)0x21, (byte)0x2f };
private static char test2_chars[] = {
0x2019
};
private static byte test3_bytes[] = {
(byte)0x1b, (byte)0x24, (byte)0x29, (byte)0x41,
(byte)0x0e,
(byte)0x21, (byte)0x2f };
private static byte test3a_bytes[] = {
(byte)0x1b, (byte)0x24, (byte)0x41,
(byte)0x0e,
(byte)0x21, (byte)0x2f };
private static char test3_chars[] = {
0x2019
};
private static byte test4_bytes[] = {
(byte)0x1b, (byte)0x24, (byte)0x29, (byte)0x41,
(byte)0x0f,
(byte)0x21, (byte)0x2f };
private static char test4_chars[] = {
0x21, 0x2f
};
private static byte test5_bytes[] = {
(byte)0x1b, (byte)0x24, (byte)0x29, (byte)0x41,
(byte)0x0e, (byte)0x21, (byte)0x2e,
(byte)0x0f, (byte)0x21, (byte)0x2f };
private static char test5_chars[] = {
0x2018, 0x21, 0x2f
};
private static byte test6_bytes[] = {
(byte)0x1b, (byte)0x24, (byte)0x29, (byte)0x41,
(byte)0x0e, (byte)0x21, (byte)0x2e,
(byte)0x21, (byte)0x2f };
private static char test6_chars[] = {
0x2018, 0x2019
};
private static byte test7_bytes[] = {
(byte)0x1b, (byte)0x24, (byte)0x29, (byte)'G',
(byte)0x0e, (byte)0x21, (byte)0x2e,
(byte)0x21, (byte)0x2f };
private static char test7_chars[] = {
0xFE50, 0xFE51
};
private static byte test8_bytes[] = {
(byte)0x1b, (byte)0x24, (byte)0x29, (byte)'G',
(byte)0x0e, (byte)0x21, (byte)0x2e,
(byte)0x0f, (byte)0x21, (byte)0x2f };
private static char test8_chars[] = {
0xFE50, 0x21, 0x2f
};
private static byte test9_bytes[] = {
(byte)0x1b, (byte)0x24, (byte)0x2a, (byte)'H',
(byte)0x1b, (byte)0x4e,
(byte)0x21, (byte)0x2f };
private static char test9_chars[] = {
0x4e0e
};
/*
* Plane 3 support provided for compatibility with
* sun.io ISO2022_CN decoder. Officially ISO-2022-CN
* just handles planes 1/2 of CNS-11643 (1986)
* Test case data below verifies this compatibility
*
*/
private static byte test10_bytes[] = {
(byte)0x1b, (byte)0x24, (byte)'+', (byte)'I',
(byte)0x1b, (byte)0x4f,
(byte)0x21, (byte)0x2f };
private static char test10_chars[] = {
0x51e2
};
private static byte test11_bytes[] = {
(byte)0x1b, (byte)0x24, (byte)0x29, (byte)0x41, //SO Designator
(byte)0x0e, //SO
(byte)0x21, (byte)0x2e, //GB2312 char
(byte)0x1b, (byte)0x24, (byte)0x2a, (byte)'H', //SS2 Designator
(byte)0x1b, (byte)0x4e, //SS2
(byte)0x21, (byte)0x2f, //CNS-P2 char
(byte)0x21, (byte)0x2f //GB2312 char
};
private static char test11_chars[] = {
0x2018,
0x4e0e,
0x2019
};
private static byte test12_bytes[] = {
(byte)0x1b, (byte)0x24, (byte)0x29, (byte)0x41, //SO Designator
(byte)0x0e, //SO
(byte)0x21, (byte)0x2e, //GB2312 char
(byte)0x1b, (byte)0x24, (byte)'+', (byte)'I', //SS3 Designator
(byte)0x1b, (byte)0x4f, //SS3
(byte)0x21, (byte)0x2f, //CNS-P2 char
(byte)0x21, (byte)0x2f //GB2312 char
};
private static char test12_chars[] = {
0x2018,
0x51e2,
0x2019
};
private static byte test13_bytes[] = {
(byte)0x0f0, // byte with MSB
};
private static char test13_chars[] = {
0x00f0,
};
private static byte test14_bytes[] = {
(byte)0x0E, (byte)0x21, (byte)0x2f,
(byte)0x0E, (byte)0xDD, (byte)0x9f
};
private static CoderResult test14_result = CoderResult.unmappableForLength(2);
// Current ISO2022CN treats the "out of range" code points as "unmappable"
private static byte test15_bytes[] = {
(byte)0x1b, (byte)0x4f, // SS3
(byte)0x20, (byte)0x2f, // "out of range" CNS-P2 char
};
private static CoderResult test15_result = CoderResult.unmappableForLength(4);
/**
* Main program to test ISO2022CN conformance
*
*/
public static void main (String argv []) throws Exception
{
boolean pass = true;
System.out.println ("");
System.out.println ("------ checking ISO2022CN decoder -----");
// This regtest must be the first one.
pass &= decodeTest6392664();
try {
new InputStreamReader (System.in, "ISO2022CN");
} catch (Exception e) {
encodingName = "ISO2022CN";
System.out.println ("... requires nonstandard encoding name "
+ encodingName);
pass &= false;
}
//
// Positive tests -- good data is dealt with correctly
//
pass &= decodeTest(test0_bytes, test0_chars, "first batch");
pass &= decodeTest(test1_bytes, test1_chars, "escapes1");
pass &= decodeTest(test2_bytes, test2_chars, "escapes2");
pass &= decodeTest(test3_bytes, test3_chars, "escapes3");
pass &= decodeTest(test3a_bytes, test3_chars, "escapes3a");
pass &= decodeTest(test4_bytes, test4_chars, "escapes4");
pass &= decodeTest(test5_bytes, test5_chars, "escapes5");
pass &= decodeTest(test6_bytes, test6_chars, "escapes6");
pass &= decodeTest(test7_bytes, test7_chars, "escapes7");
pass &= decodeTest(test8_bytes, test8_chars, "escapes8");
pass &= decodeTest(test9_bytes, test9_chars, "escapes9");
pass &= decodeTest(test10_bytes, test10_chars, "escapes10");
pass &= decodeTest(test11_bytes, test11_chars, "escapes11");
pass &= decodeTest(test12_bytes, test12_chars, "escapes12");
pass &= decodeTest(test13_bytes, test13_chars, "escapes13");
pass &= decodeResultTest(test14_bytes, test14_result, "escapes14");
pass &= decodeResultTest(test15_bytes, test15_result, "escapes15");
// PASS/FAIL status is what the whole thing is about.
//
if (! pass) {
throw new Exception("FAIL -- incorrect ISO-2022-CN");
}
}
}

View File

@ -0,0 +1,612 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4626545 4879522 4913711 4119445
@summary Check full coverage encode/decode for ISO-2022-JP
*/
/*
* Tests the NIO converter for J2RE >= 1.4.1
* since the default converter used by String
* API is the NIO converter sun.nio.cs.ext.ISO2022_JP
*/
import java.io.*;
public class TestISO2022JP {
private final static String US_ASCII =
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" +
"\b\t\n\u000B\f\r" +
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" +
"\u0018\u0019\u001A\u001C\u001D\u001E\u001F" +
"\u0020\u0021\"\u0023\u0024\u0025\u0026\'" +
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" +
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" +
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" +
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" +
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" +
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" +
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" +
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" +
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" +
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" +
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u00A5\u203E";
// Subset of chars sourced from JISX0208:1983
private final static String JISX0208SUBSET =
"u3000\u3001\u3002\uFF0C\uFF0E\u30FB\uFF1A" +
"\uFF1B\uFF1F\uFF01\u309B\u309C\u00B4\uFF40\u00A8" +
"\uFF3E\uFFE3\uFF3F\u30FD\u30FE\u309D\u309E\u3003" +
"\u4EDD\u3005\u3006\u3007\u30FC\u2014\u2010\uFF0F" +
"\uFF3C\u301C\u2016\uFF5C\u2026\u2025\u2018\u2019" +
"\u5C05\u5C07\u5C08\u5C0D\u5C13\u5C20\u5C22\u5C28" +
"\u5C38\u5C39\u5C41\u5C46\u5C4E\u5C53\u5C50\u5C4F" +
"\u5B71\u5C6C\u5C6E\u4E62\u5C76\u5C79\u5C8C\u5C91" +
"\u5C94\u599B\u5CAB\u5CBB\u5CB6\u5CBC\u5CB7\u5CC5" +
"\u5CBE\u5CC7\u5CD9\u5CE9\u5CFD\u5CFA\u5CED\u5D8C" +
"\u5CEA\u5D0B\u5D15\u5D17\u5D5C\u5D1F\u5D1B\u5D11" +
"\u5D14\u5D22\u5D1A\u5D19\u5D18\u5D4C\u5D52\u5D4E" +
"\u5D4B\u5D6C\u5D73\u5D76\u5D87\u5D84\u5D82\u5DA2" +
"\u5D9D\u5DAC\u5DAE\u5DBD\u5D90\u5DB7\u5DBC\u5DC9" +
"\u5DCD\u5DD3\u5DD2\u5DD6\u5DDB\u5DEB\u5DF2\u5DF5" +
"\u5E0B\u5E1A\u5E19\u5E11\u5E1B\u5E36\u5E37\u5E44" +
"\u5E43\u5E40\u5E4E\u5E57\u5E54\u5E5F\u5E62\u5E64" +
"\u5E47\u5E75\u5E76\u5E7A\u9EBC\u5E7F\u5EA0\u5EC1" +
"\u5EC2\u5EC8\u5ED0\u5ECF\u5ED6\u5EE3\u5EDD\u5EDA" +
"\u5EDB\u5EE2\u5EE1\u5EE8\u5EE9\u5EEC\u5EF1\u5EF3" +
"\u5EF0\u5EF4\u5EF8\u5EFE\u5F03\u5F09\u5F5D\u5F5C" +
"\u5F0B\u5F11\u5F16\u5F29\u5F2D\u5F38\u5F41\u5F48" +
"\u5F4C\u5F4E\u5F2F\u5F51\u5F56\u5F57\u5F59\u5F61" +
"\u5F6D\u5F73\u5F77\u5F83\u5F82\u5F7F\u5F8A\u5F88" +
"\u5F91\u5F87\u5F9E\u5F99\u5F98\u5FA0\u5FA8\u5FAD" +
"\u5FBC\u5FD6\u5FFB\u5FE4\u5FF8\u5FF1\u5FDD\u60B3" +
"\u5FFF\u6021\u6060\u6019\u6010\u6029\u600E\u6031" +
"\u62EE\u62F1\u6327\u6302\u6308\u62EF\u62F5\u6350" +
"\u633E\u634D\u641C\u634F\u6396\u638E\u6380\u63AB" +
"\u6376\u63A3\u638F\u6389\u639F\u63B5\u636B\u6369" +
"\u63BE\u63E9\u63C0\u63C6\u63E3\u63C9\u63D2\u63F6" +
"\u63C4\u6416\u6434\u6406\u6413\u6426\u6436\u651D" +
"\u6417\u6428\u640F\u6467\u646F\u6476\u644E\u652A" +
"\u6495\u6493\u64A5\u64A9\u6488\u64BC\u64DA\u64D2" +
"\u64C5\u64C7\u64BB\u64D8\u64C2\u64F1\u64E7\u8209" +
"\u64E0\u64E1\u62AC\u64E3\u64EF\u652C\u64F6\u64F4" +
"\u64F2\u64FA\u6500\u64FD\u6518\u651C\u6505\u6524" +
"\u6523\u652B\u6534\u6535\u6537\u6536\u6538\u754B" +
"\u6741\u6738\u6737\u6746\u675E\u6760\u6759\u6763" +
"\u6764\u6789\u6770\u67A9\u677C\u676A\u678C\u678B" +
"\u67A6\u67A1\u6785\u67B7\u67EF\u67B4\u67EC\u67B3" +
"\u67E9\u67B8\u67E4\u67DE\u67DD\u67E2\u67EE\u67B9" +
"\u67CE\u67C6\u67E7\u6A9C\u681E\u6846\u6829\u6840" +
"\u684D\u6832\u684E\u68B3\u682B\u6859\u6863\u6877" +
"\u687F\u689F\u688F\u68AD\u6894\u689D\u689B\u6883" +
"\u6AAE\u68B9\u6874\u68B5\u68A0\u68BA\u690F\u688D" +
"\u687E\u6901\u68CA\u6908\u68D8\u6922\u6926\u68E1" +
"\u690C\u68CD\u68D4\u68E7\u68D5\u6936\u6912\u6904" +
"\u68D7\u68E3\u6925\u68F9\u68E0\u68EF\u6928\u692A" +
"\u691A\u6923\u6921\u68C6\u6979\u6977\u695C\u6978" +
"\u6CD7\u6CC5\u6CDD\u6CAE\u6CB1\u6CBE\u6CBA\u6CDB" +
"\u6CEF\u6CD9\u6CEA\u6D1F\u884D\u6D36\u6D2B\u6D3D" +
"\u6D38\u6D19\u6D35\u6D33\u6D12\u6D0C\u6D63\u6D93" +
"\u6D64\u6D5A\u6D79\u6D59\u6D8E\u6D95\u6FE4\u6D85" +
"\u6DF9\u6E15\u6E0A\u6DB5\u6DC7\u6DE6\u6DB8\u6DC6" +
"\u6DEC\u6DDE\u6DCC\u6DE8\u6DD2\u6DC5\u6DFA\u6DD9" +
"\u724B\u7258\u7274\u727E\u7282\u7281\u7287\u7292" +
"\u7296\u72A2\u72A7\u72B9\u72B2\u72C3\u72C6\u72C4" +
"\u9D59\u9D72\u9D89\u9D87\u9DAB\u9D6F\u9D7A\u9D9A" +
"\u9DA4\u9DA9\u9DB2\u9DC4\u9DC1\u9DBB\u9DB8\u9DBA" +
"\u9DC6\u9DCF\u9DC2\u9DD9\u9DD3\u9DF8\u9DE6\u9DED" +
"\u9DEF\u9DFD\u9E1A\u9E1B\u9E1E\u9E75\u9E79\u9E7D" +
"\u9E81\u9E88\u9E8B\u9E8C\u9E92\u9E95\u9E91\u9E9D" +
"\u9EA5\u9EA9\u9EB8\u9EAA\u9EAD\u9761\u9ECC\u9ECE" +
"\u9ECF\u9ED0\u9ED4\u9EDC\u9EDE\u9EDD\u9EE0\u9EE5" +
"\u9EE8\u9EEF\u9EF4\u9EF6\u9EF7\u9EF9\u9EFB\u9EFC" +
"\u9EFD\u9F07\u9F08\u76B7\u9F15\u9F21\u9F2C\u9F3E" +
"\u9F4A\u9F52\u9F54\u9F63\u9F5F\u9F60\u9F61\u9F66" +
"\u9F67\u9F6C\u9F6A\u9F77\u9F72\u9F76\u9F95\u9F9C" +
"\u9FA0\u582F\u69C7\u9059\u7464\u51DC\u7199";
final static String JISX0202KATAKANA =
"\uFF61\uFF62\uFF63\uFF64" +
"\uFF65\uFF66\uFF67\uFF68\uFF69\uFF6A\uFF6B\uFF6C" +
"\uFF6D\uFF6E\uFF6F\uFF70\uFF71\uFF72\uFF73\uFF74" +
"\uFF75\uFF76\uFF77\uFF78\uFF79\uFF7A\uFF7B\uFF7C" +
"\uFF7D\uFF7E\uFF7F\uFF80\uFF81\uFF82\uFF83\uFF84" +
"\uFF85\uFF86\uFF87\uFF88\uFF89\uFF8A\uFF8B\uFF8C" +
"\uFF8D\uFF8E\uFF8F\uFF90\uFF91\uFF92\uFF93\uFF94" +
"\uFF95\uFF96\uFF97\uFF98\uFF99\uFF9A\uFF9B\uFF9C" +
"\uFF9D\uFF9E\uFF9F";
final static byte[] expectedBytes1 = {
(byte) 0x0, (byte) 0x1, (byte) 0x2, (byte) 0x3,
(byte) 0x4, (byte) 0x5, (byte) 0x6, (byte) 0x7,
(byte) 0x8, (byte) 0x9, (byte) 0xa, (byte) 0xb,
(byte) 0xc, (byte) 0xd,
(byte) 0x10, (byte) 0x11, (byte) 0x12, (byte) 0x13,
(byte) 0x14, (byte) 0x15, (byte) 0x16, (byte) 0x17,
(byte) 0x18, (byte) 0x19, (byte) 0x1a,
(byte) 0x1c, (byte) 0x1d, (byte) 0x1e, (byte) 0x1f,
(byte) 0x20, (byte) 0x21, (byte) 0x22, (byte) 0x23,
(byte) 0x24, (byte) 0x25, (byte) 0x26, (byte) 0x27,
(byte) 0x28, (byte) 0x29, (byte) 0x2a, (byte) 0x2b,
(byte) 0x2c, (byte) 0x2d, (byte) 0x2e, (byte) 0x2f,
(byte) 0x30, (byte) 0x31, (byte) 0x32, (byte) 0x33,
(byte) 0x34, (byte) 0x35, (byte) 0x36, (byte) 0x37,
(byte) 0x38, (byte) 0x39, (byte) 0x3a, (byte) 0x3b,
(byte) 0x3c, (byte) 0x3d, (byte) 0x3e, (byte) 0x3f,
(byte) 0x40, (byte) 0x41, (byte) 0x42, (byte) 0x43,
(byte) 0x44, (byte) 0x45, (byte) 0x46, (byte) 0x47,
(byte) 0x48, (byte) 0x49, (byte) 0x4a, (byte) 0x4b,
(byte) 0x4c, (byte) 0x4d, (byte) 0x4e, (byte) 0x4f,
(byte) 0x50, (byte) 0x51, (byte) 0x52, (byte) 0x53,
(byte) 0x54, (byte) 0x55, (byte) 0x56, (byte) 0x57,
(byte) 0x58, (byte) 0x59, (byte) 0x5a, (byte) 0x5b,
(byte) 0x5c, (byte) 0x5d, (byte) 0x5e, (byte) 0x5f,
(byte) 0x60, (byte) 0x61, (byte) 0x62, (byte) 0x63,
(byte) 0x64, (byte) 0x65, (byte) 0x66, (byte) 0x67,
(byte) 0x68, (byte) 0x69, (byte) 0x6a, (byte) 0x6b,
(byte) 0x6c, (byte) 0x6d, (byte) 0x6e, (byte) 0x6f,
(byte) 0x70, (byte) 0x71, (byte) 0x72, (byte) 0x73,
(byte) 0x74, (byte) 0x75, (byte) 0x76, (byte) 0x77,
(byte) 0x78, (byte) 0x79, (byte) 0x7a, (byte) 0x7b,
(byte) 0x7c, (byte) 0x7d, (byte) 0x7e, (byte) 0x1b,
(byte) 0x28, (byte) 0x4a, (byte) 0x5c, (byte) 0x7e,
(byte) 0x1b, (byte) 0x28, (byte) 0x42, (byte) 0x75,
(byte) 0x33, (byte) 0x30, (byte) 0x30, (byte) 0x30,
(byte) 0x1b, (byte) 0x24, (byte) 0x42, (byte) 0x21,
(byte) 0x22, (byte) 0x21, (byte) 0x23, (byte) 0x21,
(byte) 0x24, (byte) 0x21, (byte) 0x25, (byte) 0x21,
(byte) 0x26, (byte) 0x21, (byte) 0x27, (byte) 0x21,
(byte) 0x28, (byte) 0x21, (byte) 0x29, (byte) 0x21,
(byte) 0x2a, (byte) 0x21, (byte) 0x2b, (byte) 0x21,
(byte) 0x2c, (byte) 0x21, (byte) 0x2d, (byte) 0x21,
(byte) 0x2e, (byte) 0x21, (byte) 0x2f, (byte) 0x21,
(byte) 0x30, (byte) 0x21, (byte) 0x31, (byte) 0x21,
(byte) 0x32, (byte) 0x21, (byte) 0x33, (byte) 0x21,
(byte) 0x34, (byte) 0x21, (byte) 0x35, (byte) 0x21,
(byte) 0x36, (byte) 0x21, (byte) 0x37, (byte) 0x21,
(byte) 0x38, (byte) 0x21, (byte) 0x39, (byte) 0x21,
(byte) 0x3a, (byte) 0x21, (byte) 0x3b, (byte) 0x21,
(byte) 0x3c, (byte) 0x21, (byte) 0x3d, (byte) 0x21,
(byte) 0x3e, (byte) 0x21, (byte) 0x3f, (byte) 0x21,
(byte) 0x40, (byte) 0x21, (byte) 0x41, (byte) 0x21,
(byte) 0x42, (byte) 0x21, (byte) 0x43, (byte) 0x21,
(byte) 0x44, (byte) 0x21, (byte) 0x45, (byte) 0x21,
(byte) 0x46, (byte) 0x21, (byte) 0x47, (byte) 0x55,
(byte) 0x71, (byte) 0x55, (byte) 0x72, (byte) 0x55,
(byte) 0x73, (byte) 0x55, (byte) 0x74, (byte) 0x55,
(byte) 0x75, (byte) 0x55, (byte) 0x76, (byte) 0x55,
(byte) 0x77, (byte) 0x55, (byte) 0x78, (byte) 0x55,
(byte) 0x79, (byte) 0x55, (byte) 0x7a, (byte) 0x55,
(byte) 0x7b, (byte) 0x55, (byte) 0x7c, (byte) 0x55,
(byte) 0x7d, (byte) 0x55, (byte) 0x7e, (byte) 0x56,
(byte) 0x21, (byte) 0x56, (byte) 0x22, (byte) 0x56,
(byte) 0x23, (byte) 0x56, (byte) 0x24, (byte) 0x56,
(byte) 0x25, (byte) 0x56, (byte) 0x26, (byte) 0x56,
(byte) 0x27, (byte) 0x56, (byte) 0x28, (byte) 0x56,
(byte) 0x29, (byte) 0x56, (byte) 0x2a, (byte) 0x56,
(byte) 0x2b, (byte) 0x56, (byte) 0x2c, (byte) 0x56,
(byte) 0x2d, (byte) 0x56, (byte) 0x2e, (byte) 0x56,
(byte) 0x2f, (byte) 0x56, (byte) 0x30, (byte) 0x56,
(byte) 0x31, (byte) 0x56, (byte) 0x32, (byte) 0x56,
(byte) 0x33, (byte) 0x56, (byte) 0x34, (byte) 0x56,
(byte) 0x35, (byte) 0x56, (byte) 0x36, (byte) 0x56,
(byte) 0x37, (byte) 0x56, (byte) 0x38, (byte) 0x56,
(byte) 0x39, (byte) 0x56, (byte) 0x3a, (byte) 0x56,
(byte) 0x3b, (byte) 0x56, (byte) 0x3c, (byte) 0x56,
(byte) 0x3d, (byte) 0x56, (byte) 0x3e, (byte) 0x56,
(byte) 0x3f, (byte) 0x56, (byte) 0x40, (byte) 0x56,
(byte) 0x41, (byte) 0x56, (byte) 0x42, (byte) 0x56,
(byte) 0x43, (byte) 0x56, (byte) 0x44, (byte) 0x56,
(byte) 0x45, (byte) 0x56, (byte) 0x46, (byte) 0x56,
(byte) 0x47, (byte) 0x56, (byte) 0x48, (byte) 0x56,
(byte) 0x49, (byte) 0x56, (byte) 0x4a, (byte) 0x56,
(byte) 0x4b, (byte) 0x56, (byte) 0x4c, (byte) 0x56,
(byte) 0x4d, (byte) 0x56, (byte) 0x4e, (byte) 0x56,
(byte) 0x4f, (byte) 0x56, (byte) 0x50, (byte) 0x56,
(byte) 0x51, (byte) 0x56, (byte) 0x52, (byte) 0x56,
(byte) 0x53, (byte) 0x56, (byte) 0x54, (byte) 0x56,
(byte) 0x55, (byte) 0x56, (byte) 0x56, (byte) 0x56,
(byte) 0x57, (byte) 0x56, (byte) 0x58, (byte) 0x56,
(byte) 0x59, (byte) 0x56, (byte) 0x5a, (byte) 0x56,
(byte) 0x5b, (byte) 0x56, (byte) 0x5c, (byte) 0x56,
(byte) 0x5d, (byte) 0x56, (byte) 0x5e, (byte) 0x56,
(byte) 0x5f, (byte) 0x56, (byte) 0x60, (byte) 0x56,
(byte) 0x61, (byte) 0x56, (byte) 0x62, (byte) 0x56,
(byte) 0x63, (byte) 0x56, (byte) 0x64, (byte) 0x56,
(byte) 0x65, (byte) 0x56, (byte) 0x66, (byte) 0x56,
(byte) 0x67, (byte) 0x56, (byte) 0x68, (byte) 0x56,
(byte) 0x69, (byte) 0x56, (byte) 0x6a, (byte) 0x56,
(byte) 0x6b, (byte) 0x56, (byte) 0x6c, (byte) 0x56,
(byte) 0x6d, (byte) 0x56, (byte) 0x6e, (byte) 0x56,
(byte) 0x6f, (byte) 0x56, (byte) 0x70, (byte) 0x56,
(byte) 0x71, (byte) 0x56, (byte) 0x72, (byte) 0x56,
(byte) 0x73, (byte) 0x56, (byte) 0x74, (byte) 0x56,
(byte) 0x75, (byte) 0x56, (byte) 0x76, (byte) 0x56,
(byte) 0x77, (byte) 0x56, (byte) 0x78, (byte) 0x56,
(byte) 0x79, (byte) 0x56, (byte) 0x7a, (byte) 0x56,
(byte) 0x7b, (byte) 0x56, (byte) 0x7c, (byte) 0x56,
(byte) 0x7d, (byte) 0x56, (byte) 0x7e, (byte) 0x57,
(byte) 0x21, (byte) 0x57, (byte) 0x22, (byte) 0x57,
(byte) 0x23, (byte) 0x57, (byte) 0x24, (byte) 0x57,
(byte) 0x25, (byte) 0x57, (byte) 0x26, (byte) 0x57,
(byte) 0x27, (byte) 0x57, (byte) 0x28, (byte) 0x57,
(byte) 0x29, (byte) 0x57, (byte) 0x2a, (byte) 0x57,
(byte) 0x2b, (byte) 0x57, (byte) 0x2c, (byte) 0x57,
(byte) 0x2d, (byte) 0x57, (byte) 0x2e, (byte) 0x57,
(byte) 0x2f, (byte) 0x57, (byte) 0x30, (byte) 0x57,
(byte) 0x31, (byte) 0x57, (byte) 0x32, (byte) 0x57,
(byte) 0x33, (byte) 0x57, (byte) 0x34, (byte) 0x57,
(byte) 0x35, (byte) 0x57, (byte) 0x36, (byte) 0x57,
(byte) 0x37, (byte) 0x57, (byte) 0x38, (byte) 0x57,
(byte) 0x39, (byte) 0x57, (byte) 0x3a, (byte) 0x57,
(byte) 0x3b, (byte) 0x57, (byte) 0x3c, (byte) 0x57,
(byte) 0x3d, (byte) 0x57, (byte) 0x3e, (byte) 0x57,
(byte) 0x3f, (byte) 0x57, (byte) 0x40, (byte) 0x57,
(byte) 0x41, (byte) 0x57, (byte) 0x42, (byte) 0x57,
(byte) 0x43, (byte) 0x57, (byte) 0x44, (byte) 0x57,
(byte) 0x45, (byte) 0x57, (byte) 0x46, (byte) 0x57,
(byte) 0x47, (byte) 0x57, (byte) 0x48, (byte) 0x57,
(byte) 0x49, (byte) 0x57, (byte) 0x4a, (byte) 0x57,
(byte) 0x4b, (byte) 0x57, (byte) 0x4c, (byte) 0x57,
(byte) 0x4d, (byte) 0x57, (byte) 0x4e, (byte) 0x57,
(byte) 0x4f, (byte) 0x57, (byte) 0x50, (byte) 0x57,
(byte) 0x51, (byte) 0x57, (byte) 0x52, (byte) 0x57,
(byte) 0x53, (byte) 0x57, (byte) 0x54, (byte) 0x57,
(byte) 0x55, (byte) 0x57, (byte) 0x56, (byte) 0x57,
(byte) 0x57, (byte) 0x57, (byte) 0x58, (byte) 0x57,
(byte) 0x59, (byte) 0x57, (byte) 0x5a, (byte) 0x57,
(byte) 0x5b, (byte) 0x57, (byte) 0x5c, (byte) 0x57,
(byte) 0x5d, (byte) 0x57, (byte) 0x5e, (byte) 0x57,
(byte) 0x5f, (byte) 0x57, (byte) 0x60, (byte) 0x57,
(byte) 0x61, (byte) 0x57, (byte) 0x62, (byte) 0x57,
(byte) 0x63, (byte) 0x57, (byte) 0x64, (byte) 0x59,
(byte) 0x49, (byte) 0x59, (byte) 0x4a, (byte) 0x59,
(byte) 0x4b, (byte) 0x59, (byte) 0x4c, (byte) 0x59,
(byte) 0x4d, (byte) 0x59, (byte) 0x4e, (byte) 0x59,
(byte) 0x4f, (byte) 0x59, (byte) 0x50, (byte) 0x59,
(byte) 0x51, (byte) 0x59, (byte) 0x52, (byte) 0x59,
(byte) 0x53, (byte) 0x59, (byte) 0x54, (byte) 0x59,
(byte) 0x55, (byte) 0x59, (byte) 0x56, (byte) 0x59,
(byte) 0x57, (byte) 0x59, (byte) 0x58, (byte) 0x59,
(byte) 0x59, (byte) 0x59, (byte) 0x5a, (byte) 0x59,
(byte) 0x5b, (byte) 0x59, (byte) 0x5c, (byte) 0x59,
(byte) 0x5d, (byte) 0x59, (byte) 0x5e, (byte) 0x59,
(byte) 0x5f, (byte) 0x59, (byte) 0x60, (byte) 0x59,
(byte) 0x61, (byte) 0x59, (byte) 0x62, (byte) 0x59,
(byte) 0x63, (byte) 0x59, (byte) 0x64, (byte) 0x59,
(byte) 0x65, (byte) 0x59, (byte) 0x66, (byte) 0x59,
(byte) 0x67, (byte) 0x59, (byte) 0x68, (byte) 0x59,
(byte) 0x69, (byte) 0x59, (byte) 0x6a, (byte) 0x59,
(byte) 0x6b, (byte) 0x59, (byte) 0x6c, (byte) 0x59,
(byte) 0x6d, (byte) 0x59, (byte) 0x6e, (byte) 0x59,
(byte) 0x6f, (byte) 0x59, (byte) 0x70, (byte) 0x59,
(byte) 0x71, (byte) 0x59, (byte) 0x72, (byte) 0x59,
(byte) 0x73, (byte) 0x59, (byte) 0x74, (byte) 0x59,
(byte) 0x75, (byte) 0x59, (byte) 0x76, (byte) 0x59,
(byte) 0x77, (byte) 0x59, (byte) 0x78, (byte) 0x59,
(byte) 0x79, (byte) 0x59, (byte) 0x7a, (byte) 0x59,
(byte) 0x7b, (byte) 0x59, (byte) 0x7c, (byte) 0x59,
(byte) 0x7d, (byte) 0x59, (byte) 0x7e, (byte) 0x5a,
(byte) 0x21, (byte) 0x5a, (byte) 0x22, (byte) 0x5a,
(byte) 0x23, (byte) 0x5a, (byte) 0x24, (byte) 0x5a,
(byte) 0x25, (byte) 0x5a, (byte) 0x26, (byte) 0x5a,
(byte) 0x27, (byte) 0x5a, (byte) 0x28, (byte) 0x5a,
(byte) 0x29, (byte) 0x5a, (byte) 0x2a, (byte) 0x5a,
(byte) 0x2b, (byte) 0x5a, (byte) 0x2c, (byte) 0x5a,
(byte) 0x2d, (byte) 0x5a, (byte) 0x2e, (byte) 0x5a,
(byte) 0x2f, (byte) 0x5a, (byte) 0x30, (byte) 0x5a,
(byte) 0x31, (byte) 0x5a, (byte) 0x32, (byte) 0x5a,
(byte) 0x33, (byte) 0x5a, (byte) 0x34, (byte) 0x5a,
(byte) 0x35, (byte) 0x5a, (byte) 0x36, (byte) 0x5a,
(byte) 0x37, (byte) 0x5a, (byte) 0x38, (byte) 0x5a,
(byte) 0x39, (byte) 0x5a, (byte) 0x3a, (byte) 0x5a,
(byte) 0x3b, (byte) 0x5a, (byte) 0x3c, (byte) 0x5a,
(byte) 0x3d, (byte) 0x5a, (byte) 0x3e, (byte) 0x5a,
(byte) 0x3f, (byte) 0x5a, (byte) 0x40, (byte) 0x5a,
(byte) 0x41, (byte) 0x5a, (byte) 0x42, (byte) 0x5b,
(byte) 0x35, (byte) 0x5b, (byte) 0x36, (byte) 0x5b,
(byte) 0x37, (byte) 0x5b, (byte) 0x38, (byte) 0x5b,
(byte) 0x39, (byte) 0x5b, (byte) 0x3a, (byte) 0x5b,
(byte) 0x3b, (byte) 0x5b, (byte) 0x3c, (byte) 0x5b,
(byte) 0x3d, (byte) 0x5b, (byte) 0x3e, (byte) 0x5b,
(byte) 0x3f, (byte) 0x5b, (byte) 0x40, (byte) 0x5b,
(byte) 0x41, (byte) 0x5b, (byte) 0x42, (byte) 0x5b,
(byte) 0x43, (byte) 0x5b, (byte) 0x44, (byte) 0x5b,
(byte) 0x45, (byte) 0x5b, (byte) 0x46, (byte) 0x5b,
(byte) 0x47, (byte) 0x5b, (byte) 0x48, (byte) 0x5b,
(byte) 0x49, (byte) 0x5b, (byte) 0x4a, (byte) 0x5b,
(byte) 0x4b, (byte) 0x5b, (byte) 0x4c, (byte) 0x5b,
(byte) 0x4d, (byte) 0x5b, (byte) 0x4e, (byte) 0x5b,
(byte) 0x4f, (byte) 0x5b, (byte) 0x50, (byte) 0x5b,
(byte) 0x51, (byte) 0x5b, (byte) 0x52, (byte) 0x5b,
(byte) 0x53, (byte) 0x5b, (byte) 0x54, (byte) 0x5b,
(byte) 0x55, (byte) 0x5b, (byte) 0x56, (byte) 0x5b,
(byte) 0x57, (byte) 0x5b, (byte) 0x58, (byte) 0x5b,
(byte) 0x59, (byte) 0x5b, (byte) 0x5a, (byte) 0x5b,
(byte) 0x5b, (byte) 0x5b, (byte) 0x5c, (byte) 0x5b,
(byte) 0x5d, (byte) 0x5b, (byte) 0x5e, (byte) 0x5b,
(byte) 0x5f, (byte) 0x5b, (byte) 0x60, (byte) 0x5b,
(byte) 0x61, (byte) 0x5b, (byte) 0x62, (byte) 0x5b,
(byte) 0x63, (byte) 0x5b, (byte) 0x64, (byte) 0x5b,
(byte) 0x65, (byte) 0x5b, (byte) 0x66, (byte) 0x5b,
(byte) 0x67, (byte) 0x5b, (byte) 0x68, (byte) 0x5b,
(byte) 0x69, (byte) 0x5b, (byte) 0x6a, (byte) 0x5b,
(byte) 0x6b, (byte) 0x5b, (byte) 0x6c, (byte) 0x5b,
(byte) 0x6d, (byte) 0x5b, (byte) 0x6e, (byte) 0x5b,
(byte) 0x6f, (byte) 0x5b, (byte) 0x70, (byte) 0x5b,
(byte) 0x71, (byte) 0x5b, (byte) 0x72, (byte) 0x5b,
(byte) 0x73, (byte) 0x5b, (byte) 0x74, (byte) 0x5b,
(byte) 0x75, (byte) 0x5b, (byte) 0x76, (byte) 0x5b,
(byte) 0x77, (byte) 0x5b, (byte) 0x78, (byte) 0x5b,
(byte) 0x79, (byte) 0x5b, (byte) 0x7a, (byte) 0x5b,
(byte) 0x7b, (byte) 0x5b, (byte) 0x7c, (byte) 0x5b,
(byte) 0x7d, (byte) 0x5b, (byte) 0x7e, (byte) 0x5c,
(byte) 0x21, (byte) 0x5c, (byte) 0x22, (byte) 0x5c,
(byte) 0x23, (byte) 0x5c, (byte) 0x24, (byte) 0x5c,
(byte) 0x25, (byte) 0x5c, (byte) 0x26, (byte) 0x5c,
(byte) 0x27, (byte) 0x5c, (byte) 0x28, (byte) 0x5c,
(byte) 0x29, (byte) 0x5c, (byte) 0x2a, (byte) 0x5c,
(byte) 0x2b, (byte) 0x5c, (byte) 0x2c, (byte) 0x5c,
(byte) 0x2d, (byte) 0x5c, (byte) 0x2e, (byte) 0x5c,
(byte) 0x2f, (byte) 0x5c, (byte) 0x30, (byte) 0x5c,
(byte) 0x31, (byte) 0x5c, (byte) 0x32, (byte) 0x5c,
(byte) 0x33, (byte) 0x5c, (byte) 0x34, (byte) 0x5c,
(byte) 0x35, (byte) 0x5c, (byte) 0x36, (byte) 0x5d,
(byte) 0x79, (byte) 0x5d, (byte) 0x7a, (byte) 0x5d,
(byte) 0x7b, (byte) 0x5d, (byte) 0x7c, (byte) 0x5d,
(byte) 0x7d, (byte) 0x5d, (byte) 0x7e, (byte) 0x5e,
(byte) 0x21, (byte) 0x5e, (byte) 0x22, (byte) 0x5e,
(byte) 0x23, (byte) 0x5e, (byte) 0x24, (byte) 0x5e,
(byte) 0x25, (byte) 0x5e, (byte) 0x26, (byte) 0x5e,
(byte) 0x27, (byte) 0x5e, (byte) 0x28, (byte) 0x5e,
(byte) 0x29, (byte) 0x5e, (byte) 0x2a, (byte) 0x5e,
(byte) 0x2b, (byte) 0x5e, (byte) 0x2c, (byte) 0x5e,
(byte) 0x2d, (byte) 0x5e, (byte) 0x2e, (byte) 0x5e,
(byte) 0x2f, (byte) 0x5e, (byte) 0x30, (byte) 0x5e,
(byte) 0x31, (byte) 0x5e, (byte) 0x32, (byte) 0x5e,
(byte) 0x33, (byte) 0x5e, (byte) 0x34, (byte) 0x5e,
(byte) 0x35, (byte) 0x5e, (byte) 0x36, (byte) 0x5e,
(byte) 0x37, (byte) 0x5e, (byte) 0x38, (byte) 0x5e,
(byte) 0x39, (byte) 0x5e, (byte) 0x3a, (byte) 0x5e,
(byte) 0x3b, (byte) 0x5e, (byte) 0x3c, (byte) 0x5e,
(byte) 0x3d, (byte) 0x5e, (byte) 0x3e, (byte) 0x5e,
(byte) 0x3f, (byte) 0x5e, (byte) 0x40, (byte) 0x5e,
(byte) 0x41, (byte) 0x5e, (byte) 0x42, (byte) 0x5e,
(byte) 0x43, (byte) 0x5e, (byte) 0x44, (byte) 0x5e,
(byte) 0x45, (byte) 0x5e, (byte) 0x46, (byte) 0x5e,
(byte) 0x47, (byte) 0x5e, (byte) 0x48, (byte) 0x5e,
(byte) 0x49, (byte) 0x5e, (byte) 0x4a, (byte) 0x60,
(byte) 0x30, (byte) 0x60, (byte) 0x31, (byte) 0x60,
(byte) 0x32, (byte) 0x60, (byte) 0x33, (byte) 0x60,
(byte) 0x34, (byte) 0x60, (byte) 0x35, (byte) 0x60,
(byte) 0x36, (byte) 0x60, (byte) 0x37, (byte) 0x60,
(byte) 0x38, (byte) 0x60, (byte) 0x39, (byte) 0x60,
(byte) 0x3a, (byte) 0x60, (byte) 0x3b, (byte) 0x60,
(byte) 0x3c, (byte) 0x60, (byte) 0x3d, (byte) 0x60,
(byte) 0x3e, (byte) 0x60, (byte) 0x3f, (byte) 0x73,
(byte) 0x26, (byte) 0x73, (byte) 0x27, (byte) 0x73,
(byte) 0x28, (byte) 0x73, (byte) 0x29, (byte) 0x73,
(byte) 0x2a, (byte) 0x73, (byte) 0x2b, (byte) 0x73,
(byte) 0x2c, (byte) 0x73, (byte) 0x2d, (byte) 0x73,
(byte) 0x2e, (byte) 0x73, (byte) 0x2f, (byte) 0x73,
(byte) 0x30, (byte) 0x73, (byte) 0x31, (byte) 0x73,
(byte) 0x32, (byte) 0x73, (byte) 0x33, (byte) 0x73,
(byte) 0x34, (byte) 0x73, (byte) 0x35, (byte) 0x73,
(byte) 0x36, (byte) 0x73, (byte) 0x37, (byte) 0x73,
(byte) 0x38, (byte) 0x73, (byte) 0x39, (byte) 0x73,
(byte) 0x3a, (byte) 0x73, (byte) 0x3b, (byte) 0x73,
(byte) 0x3c, (byte) 0x73, (byte) 0x3d, (byte) 0x73,
(byte) 0x3e, (byte) 0x73, (byte) 0x3f, (byte) 0x73,
(byte) 0x40, (byte) 0x73, (byte) 0x41, (byte) 0x73,
(byte) 0x42, (byte) 0x73, (byte) 0x43, (byte) 0x73,
(byte) 0x44, (byte) 0x73, (byte) 0x45, (byte) 0x73,
(byte) 0x46, (byte) 0x73, (byte) 0x47, (byte) 0x73,
(byte) 0x48, (byte) 0x73, (byte) 0x49, (byte) 0x73,
(byte) 0x4a, (byte) 0x73, (byte) 0x4b, (byte) 0x73,
(byte) 0x4c, (byte) 0x73, (byte) 0x4d, (byte) 0x73,
(byte) 0x4e, (byte) 0x73, (byte) 0x4f, (byte) 0x73,
(byte) 0x50, (byte) 0x73, (byte) 0x51, (byte) 0x73,
(byte) 0x52, (byte) 0x73, (byte) 0x53, (byte) 0x73,
(byte) 0x54, (byte) 0x73, (byte) 0x55, (byte) 0x73,
(byte) 0x56, (byte) 0x73, (byte) 0x57, (byte) 0x73,
(byte) 0x58, (byte) 0x73, (byte) 0x59, (byte) 0x73,
(byte) 0x5a, (byte) 0x73, (byte) 0x5b, (byte) 0x73,
(byte) 0x5c, (byte) 0x73, (byte) 0x5d, (byte) 0x73,
(byte) 0x5e, (byte) 0x73, (byte) 0x5f, (byte) 0x73,
(byte) 0x60, (byte) 0x73, (byte) 0x61, (byte) 0x73,
(byte) 0x62, (byte) 0x73, (byte) 0x63, (byte) 0x73,
(byte) 0x64, (byte) 0x73, (byte) 0x65, (byte) 0x73,
(byte) 0x66, (byte) 0x73, (byte) 0x67, (byte) 0x73,
(byte) 0x68, (byte) 0x73, (byte) 0x69, (byte) 0x73,
(byte) 0x6a, (byte) 0x73, (byte) 0x6b, (byte) 0x73,
(byte) 0x6c, (byte) 0x73, (byte) 0x6d, (byte) 0x73,
(byte) 0x6e, (byte) 0x73, (byte) 0x6f, (byte) 0x73,
(byte) 0x70, (byte) 0x73, (byte) 0x71, (byte) 0x73,
(byte) 0x72, (byte) 0x73, (byte) 0x73, (byte) 0x73,
(byte) 0x74, (byte) 0x73, (byte) 0x75, (byte) 0x73,
(byte) 0x76, (byte) 0x73, (byte) 0x77, (byte) 0x73,
(byte) 0x78, (byte) 0x73, (byte) 0x79, (byte) 0x73,
(byte) 0x7a, (byte) 0x73, (byte) 0x7b, (byte) 0x73,
(byte) 0x7c, (byte) 0x73, (byte) 0x7d, (byte) 0x73,
(byte) 0x7e, (byte) 0x74, (byte) 0x21, (byte) 0x74,
(byte) 0x22, (byte) 0x74, (byte) 0x23, (byte) 0x74,
(byte) 0x24, (byte) 0x74, (byte) 0x25, (byte) 0x74,
(byte) 0x26, (byte) 0x1b, (byte) 0x28, (byte) 0x49,
(byte) 0x21, (byte) 0x22, (byte) 0x23, (byte) 0x24,
(byte) 0x25, (byte) 0x26, (byte) 0x27, (byte) 0x28,
(byte) 0x29, (byte) 0x2a, (byte) 0x2b, (byte) 0x2c,
(byte) 0x2d, (byte) 0x2e, (byte) 0x2f, (byte) 0x30,
(byte) 0x31, (byte) 0x32, (byte) 0x33, (byte) 0x34,
(byte) 0x35, (byte) 0x36, (byte) 0x37, (byte) 0x38,
(byte) 0x39, (byte) 0x3a, (byte) 0x3b, (byte) 0x3c,
(byte) 0x3d, (byte) 0x3e, (byte) 0x3f, (byte) 0x40,
(byte) 0x41, (byte) 0x42, (byte) 0x43, (byte) 0x44,
(byte) 0x45, (byte) 0x46, (byte) 0x47, (byte) 0x48,
(byte) 0x49, (byte) 0x4a, (byte) 0x4b, (byte) 0x4c,
(byte) 0x4d, (byte) 0x4e, (byte) 0x4f, (byte) 0x50,
(byte) 0x51, (byte) 0x52, (byte) 0x53, (byte) 0x54,
(byte) 0x55, (byte) 0x56, (byte) 0x57, (byte) 0x58,
(byte) 0x59, (byte) 0x5a, (byte) 0x5b, (byte) 0x5c,
(byte) 0x5d, (byte) 0x5e, (byte) 0x5f, (byte) 0x1b,
(byte) 0x28, (byte) 0x42 };
private final static String MIXEDCONTENT =
"JA\u3000\u3002\u0062\uFF64PAN" +
"\uFF0C\uFF0E\u00A5\uFF65\uFF66X\u203E" +
"\u30FB\uFF67\u203E";
static byte[] mixedBytesExpected = {
(byte) 0x4a, (byte) 0x41, (byte) 0x1b, (byte) 0x24,
(byte) 0x42, (byte) 0x21, (byte) 0x21, (byte) 0x21,
(byte) 0x23, (byte) 0x1b, (byte) 0x28, (byte) 0x42,
(byte) 0x62, (byte) 0x1b, (byte) 0x28, (byte) 0x49,
(byte) 0x24, (byte) 0x1b, (byte) 0x28, (byte) 0x42,
(byte) 0x50, (byte) 0x41, (byte) 0x4e, (byte) 0x1b,
(byte) 0x24, (byte) 0x42, (byte) 0x21, (byte) 0x24,
(byte) 0x21, (byte) 0x25, (byte) 0x1b, (byte) 0x28,
(byte) 0x4a, (byte) 0x5c, (byte) 0x1b, (byte) 0x28,
(byte) 0x49, (byte) 0x25, (byte) 0x26, (byte) 0x1b,
(byte) 0x28, (byte) 0x42, (byte) 0x58, (byte) 0x1b,
(byte) 0x28, (byte) 0x4a, (byte) 0x7e, (byte) 0x1b,
(byte) 0x24, (byte) 0x42, (byte) 0x21, (byte) 0x26,
(byte) 0x1b, (byte) 0x28, (byte) 0x49, (byte) 0x27,
(byte) 0x1b, (byte) 0x28, (byte) 0x4a, (byte) 0x7e,
(byte) 0x1b, (byte) 0x28, (byte) 0x42 };
static byte[] repeatingEscapes = {
(byte) 0x4a, (byte) 0x41, (byte) 0x1b, (byte) 0x24,
(byte) 0x42, (byte)0x1b, (byte)0x24, (byte)0x42,
(byte) 0x21, (byte) 0x21, (byte) 0x21,
(byte) 0x23, (byte) 0x1b, (byte) 0x28, (byte) 0x42,
// embedded repeated iso-2022 escapes (see bugID 4879522)
(byte)0x1b, (byte)0x28, (byte)0x42,
(byte) 0x62, (byte) 0x1b, (byte) 0x28, (byte) 0x49,
(byte)0x0f, (byte)0x0e, (byte)0x0f,
(byte)0x1b, (byte)0x28, (byte)0x49,
(byte) 0x24, (byte) 0x1b, (byte) 0x28, (byte) 0x42,
(byte) 0x50, (byte) 0x41, (byte) 0x4e,
// embedded shift chars (see bugID 4879522)
(byte)0x0e, (byte)0x0f,
(byte) 0x1b,
(byte) 0x24, (byte) 0x42, (byte) 0x21, (byte) 0x24,
(byte) 0x21, (byte) 0x25, (byte) 0x1b, (byte) 0x28,
(byte) 0x4a, (byte) 0x5c, (byte) 0x1b, (byte) 0x28,
(byte) 0x49, (byte) 0x25, (byte) 0x26, (byte) 0x1b,
(byte) 0x28, (byte) 0x42, (byte) 0x58, (byte) 0x1b,
(byte) 0x28, (byte) 0x4a, (byte) 0x7e, (byte) 0x1b,
(byte) 0x24, (byte) 0x42, (byte) 0x21, (byte) 0x26,
(byte) 0x1b, (byte) 0x28, (byte) 0x49, (byte) 0x27,
(byte) 0x1b, (byte) 0x28, (byte) 0x4a, (byte) 0x7e,
(byte) 0x1b, (byte) 0x28, (byte) 0x42 };
private static String JISX0212 =
"\u02d8\u6896\u9fa5";
private static byte[] expectedBytes_JISX0212 = {
(byte)0x1b, (byte)0x24, (byte)0x28, (byte)0x44,
(byte)0x22, (byte)0x2f, (byte)0x43, (byte)0x6f,
(byte)0x6d, (byte)0x63,
(byte)0x1b, (byte)0x28, (byte)0x42
};
/*
* Tests the roundtrip integrity and expected encoding
* correctness for a String containing a substantial
* subset of ISO-2022-JP/ISO-2022-JP-2 encodeable chars
*/
private static void roundTrip(String testStr, byte[] expectBytes,
String csName)
throws Exception {
byte[] encodedBytes = testStr.getBytes(csName);
if (encodedBytes.length != expectBytes.length) {
throw new Exception(csName + " Encoder error");
}
for (int i = 0; i < expectBytes.length; i++) {
if (encodedBytes[i] != expectBytes[i]) {
throw new Exception(csName + " Encoder error");
}
}
String decoded = new String(encodedBytes, csName);
if (!decoded.equals(testStr)) {
throw new Exception(csName + " Decoder error");
}
String decoded2 = new String(repeatingEscapes, csName);
if (!decoded2.equals(MIXEDCONTENT)) {
throw new Exception(csName + " Decoder error");
}
}
public static void main(String[] args) throws Exception {
// Long String containing sequential chars
// ASCII/yen/tilde/jisx0208 chars/katakana chars
String testStr1 = US_ASCII +
JISX0208SUBSET + JISX0202KATAKANA;
roundTrip(testStr1, expectedBytes1, "ISO-2022-JP");
roundTrip(testStr1, expectedBytes1, "ISO-2022-JP-2");
roundTrip(JISX0212, expectedBytes_JISX0212, "ISO-2022-JP-2");
// mixed chars which encode to the supported codesets
// of ISO-2022-JP/ISO-2022-JP-2
String testStr2 = MIXEDCONTENT;
roundTrip(testStr2 , mixedBytesExpected, "ISO-2022-JP");
roundTrip(testStr2 , mixedBytesExpected, "ISO-2022-JP-2");
String decoded2 = new String(repeatingEscapes, "ISO-2022-JP");
if (!decoded2.equals(MIXEDCONTENT)) {
throw new Exception("ISO-2022-JP Decoder error");
}
decoded2 = new String(repeatingEscapes, "ISO-2022-JP-2");
if (!decoded2.equals(MIXEDCONTENT)) {
throw new Exception("ISO-2022-JP-2 Decoder error");
}
// Test for bugID 4913711
// ISO-2022-JP encoding of a single input char yields
// 8 output bytes. Prior to fix for 4913711 the
// max bytes per char value was underspecified as 5.0
// and the code below would have thrown a BufferOverflow
// exception. This test validates the fix for 4913711
String testStr3 = "\u3042";
byte[] expected = { (byte)0x1b, (byte)0x24, (byte)0x42,
(byte)0x24, (byte)0x22, (byte)0x1b,
(byte)0x28, (byte)0x42 };
byte[] encoded = testStr3.getBytes("ISO-2022-JP");
for (int i = 0; i < expected.length; i++) {
if (encoded[i] != expected[i])
throw new Exception("ISO-2022-JP Decoder error");
}
}
}

View File

@ -0,0 +1,73 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4251646
@summary Make sure buffer boundary convert works
*/
import java.nio.*;
import java.nio.charset.*;
public class TestISO2022JPEncoder {
static char[] inputChars = {'\u0020', '\u0020', '\u0020', '\u0020',
'\u0020', '\u0020', '\u0020', '\u0020',
'\u0020', '\u4e00'};
static byte[] expectedBytes1 = {0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20};
static byte[] expectedBytes2 = {0x1b, 0x24, 0x42, 0x30, 0x6c,
0x1b, 0x28, 0x42};
static byte[] outputBuff = new byte[10];
public static void main(String args[]) throws Exception {
CharsetEncoder enc = Charset.forName("ISO2022JP").newEncoder();
CharBuffer cb = CharBuffer.wrap(inputChars);
ByteBuffer bb = ByteBuffer.wrap(outputBuff);
CoderResult cr = enc.encode(cb, bb, false);
if (!cr.isOverflow())
throw new Exception("Expected CodeResult.OVERFLOW was not returned");
for (int i = 0; i < expectedBytes1.length; ++i) {
//System.out.println(expectedBytes1[i] + ":" + outputBuff[i]);
if (expectedBytes1[i] != outputBuff[i]) {
throw new Exception("Output bytes does not match at first conversion");
}
}
int nci = cb.position();
if (nci != expectedBytes1.length)
throw new Exception("Output length does not match at first conversion");
bb.clear();
cr = enc.encode(cb, bb, true);
enc.flush(bb);
//System.out.println(ret + "," + expectedBytes2.length);
bb.flip();
int len = bb.remaining();
if (len != expectedBytes2.length)
throw new Exception("Output length does not match at second conversion");
for (int i = 0; i < expectedBytes2.length; ++i) {
//System.out.println(expectedBytes2[i] + ":" + outputBuff[i]);
if (expectedBytes2[i] != outputBuff[i]) {
throw new Exception("Output bytes does not match at second conversion");
}
}
}
}

View File

@ -0,0 +1,101 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4262894 6233303
@summary Testing substitute character Escape sequence
*/
import java.nio.*;
import java.nio.charset.*;
public class TestISO2022JPSubBytes {
/* \U2460 is not valid character in ISO2022JP and will be substituted
* with replacement character. If the replacement character is not the
* "current charset" character, correct escape sequence should be output
* for changing character set.
*/
static char[][] in = { {'\u25cb', '\u2460', '\u25cb'},
{'\u0061', '\u2460', '\u0061'},
{'\u25cb', '\u2460', '\u25cb'},
{'\u0061', '\u2460', '\u0061'},
};
static byte[][] expected = { {0x1b, 0x24, 0x42, 0x21, 0x7b,
0x21, 0x29,
0x21, 0x7b,
0x1b, 0x28, 0x42},
{0x61,
0x1b, 0x24, 0x42, 0x21, 0x29,
0x1b, 0x28, 0x42, 0x61},
{0x1b, 0x24, 0x42, 0x21, 0x7b,
0x1b, 0x28, 0x42, 0x3f,
0x1b, 0x24, 0x42, 0x21, 0x7b,
0x1b, 0x28, 0x42},
{0x61,
0x3f,
0x61}
};
public static void main(String args[]) throws Exception {
CharsetEncoder enc = Charset.forName("ISO2022JP")
.newEncoder()
.onUnmappableCharacter(CodingErrorAction.REPLACE);
test(enc, in[0], expected[0]);
enc.reset();
test(enc, in[1], expected[1]);
enc.reset();
enc.replaceWith(new byte[]{(byte)'?'});
test(enc, in[2], expected[2]);
enc.reset();
test(enc, in[3], expected[3]);
}
public static void test (CharsetEncoder enc,
char[] inputChars,
byte[] expectedBytes) throws Exception
{
ByteBuffer bb = ByteBuffer.allocate(expectedBytes.length);
enc.encode(CharBuffer.wrap(inputChars), bb, true);
enc.flush(bb);
bb.flip();
byte[] outputBuff = bb.array();
int outputLen = bb.limit();
if (outputLen != expectedBytes.length) {
throw new Exception("Output bytes does not match");
}
for (int i = 0; i < outputLen; ++i) {
System.out.printf("<%x:%x> ",
expectedBytes[i] & 0xff,
outputBuff[i] & 0xff);
if (expectedBytes[i] != outputBuff[i]) {
System.out.println("...");
throw new Exception("Output bytes does not match");
}
}
System.out.println();
}
}

View File

@ -0,0 +1,60 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4429369
@summary ISO2022CN and ISO2022KR converters throw exception
*/
import java.io.*;
import java.nio.charset.*;
public class TestIllegalISO2022Esc {
public static void main ( String[] args) throws Exception {
int exceptionCount = 0;
String[] encName = {"ISO2022CN", "ISO2022KR" };
byte[]b= {
(byte)0x1b, //Illegal sequence for both converters.
(byte)')',
(byte)'x'
};
for ( int i=0; i < 2; i++) { // Test 2 converters.
try {
ByteArrayInputStream bais = new ByteArrayInputStream(b);
InputStreamReader isr =
new InputStreamReader(bais,encName[i]);
char cc[] = new char[1];
isr.read(cc,0,1); //attempt to read
} catch (MalformedInputException e) { } // Passes if thrown
catch (Throwable t) {
System.err.println("error with converter " + encName[i]);
exceptionCount++;
}
}
if (exceptionCount > 0)
throw new Exception ("Incorrect handling of illegal ISO2022 escapes");
}
}

View File

@ -0,0 +1,50 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4117820
@summary Verify that SJIS.Decoder works properly for values between 0xA000 and 0xA0FC
*/
import java.nio.charset.*;
import java.nio.*;
public class TestIllegalSJIS {
public static void main(String[] args) throws Exception
{
CharsetDecoder dec = Charset.forName("SJIS").newDecoder()
.onUnmappableCharacter(CodingErrorAction.REPLACE)
.onMalformedInput(CodingErrorAction.REPLACE);
byte[] sjis = {(byte)0xA0, (byte)0x00};
int b;
for (b = 0; b < 0xFD; b++) {
sjis[1] = (byte) b;
CharBuffer cb = dec.decode(ByteBuffer.wrap(sjis));
if (cb.charAt(0) != 0xFFFD) {
throw new Exception(Integer.toHexString(0xa000 + b) + " failed to convert to 0xFFFD");
}
}
}
}

View File

@ -0,0 +1,61 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 4179800
* @summary Make sure JIS0208.Decoder really works
*/
import java.nio.*;
import java.nio.charset.*;
public class TestJIS0208Decoder {
static String outputString = "\u65e5\u672c\u8a9e\u30c6\u30ad\u30b9\u30c8";
static byte [] inputBytes = new byte[] {(byte)'F', (byte)'|', (byte)'K', (byte)'\\',
(byte)'8', (byte)'l', (byte)'%', (byte)'F',
(byte)'%', (byte)'-', (byte)'%', (byte)'9',
(byte)'%', (byte)'H'};
public static void main(String args[])
throws Exception
{
test();
}
private static void test()
throws Exception
{
CharsetDecoder dec = Charset.forName("JIS0208").newDecoder();
try {
String ret = dec.decode(ByteBuffer.wrap(inputBytes)).toString();
if (ret.length() != outputString.length()
|| ! outputString.equals(ret)){
throw new Exception("ByteToCharJIS0208 does not work correctly");
}
}
catch (Exception e){
throw new Exception("ByteToCharJIS0208 does not work correctly");
}
}
}

View File

@ -0,0 +1,62 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
@bug 4179800
@summary Make sure JIS0212.Decoder really works
*/
import java.nio.*;
import java.nio.charset.*;
public class TestJIS0212Decoder {
static String outputString = "\u4e02\u4e04\u4e05\u4e0c\u4e12\u4e1f\u4e23";
static char [] outputChars = new char[8];
static byte [] inputBytes = new byte[] {(byte)0x30, (byte)0x21, (byte)0x30, (byte)0x22,
(byte)0x30, (byte)0x23, (byte)0x30, (byte)0x24,
(byte)0x30, (byte)0x25, (byte)0x30, (byte)0x26,
(byte)0x30, (byte)0x27};
public static void main(String args[])
throws Exception
{
test();
}
private static void test()
throws Exception
{
CharsetDecoder dec = Charset.forName("JIS0212").newDecoder();
try {
String ret = dec.decode(ByteBuffer.wrap(inputBytes)).toString();
if (ret.length() != outputString.length()
|| ! outputString.equals(ret)){
throw new Exception("ByteToCharJIS0212 does not work correctly");
}
}
catch (Exception e){
throw new Exception("ByteToCharJIS0212 does not work correctly");
}
}
}

View File

@ -0,0 +1,750 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 6173388 6319716
@summary Check full coverage encode/decode for Microsoft
ISO2022_JP variants MS50220, MS50221 and MSISO2022JP
*/
import java.io.*;
import java.nio.charset.*;
public class TestMS5022X {
private static String US_ASCII =
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" +
"\b\t\n\u000B\f\r" +
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" +
"\u0018\u0019\u001A\u001C\u001D\u001E\u001F" +
"\u0020\u0021\"\u0023\u0024\u0025\u0026\'" +
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" +
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" +
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" +
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" +
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" +
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" +
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" +
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" +
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" +
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" +
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u00A5\u203E";
// Subset of chars sourced from JISX0208:1983
private static String JISX0208SUBSET =
"\u3000\u3001\u3002\uFF0C\uFF0E\u30FB\uFF1A" +
"\uFF1B\uFF1F\uFF01\u309B\u309C\u00B4\uFF40\u00A8" +
"\uFF3E\uFFE3\uFF3F\u30FD\u30FE\u309D\u309E\u3003" +
"\u4EDD\u3005\u3006\u3007\u30FC\u2015\u2010\uFF0F" + //u2014->u2015
"\uFF3C\u301C\u2016\uFF5C\u2026\u2025\u2018\u2019" +
"\u5C05\u5C07\u5C08\u5C0D\u5C13\u5C20\u5C22\u5C28" +
"\u5C38\u5C39\u5C41\u5C46\u5C4E\u5C53\u5C50\u5C4F" +
"\u5B71\u5C6C\u5C6E\u4E62\u5C76\u5C79\u5C8C\u5C91" +
"\u5C94\u599B\u5CAB\u5CBB\u5CB6\u5CBC\u5CB7\u5CC5" +
"\u5CBE\u5CC7\u5CD9\u5CE9\u5CFD\u5CFA\u5CED\u5D8C" +
"\u5CEA\u5D0B\u5D15\u5D17\u5D5C\u5D1F\u5D1B\u5D11" +
"\u5D14\u5D22\u5D1A\u5D19\u5D18\u5D4C\u5D52\u5D4E" +
"\u5D4B\u5D6C\u5D73\u5D76\u5D87\u5D84\u5D82\u5DA2" +
"\u5D9D\u5DAC\u5DAE\u5DBD\u5D90\u5DB7\u5DBC\u5DC9" +
"\u5DCD\u5DD3\u5DD2\u5DD6\u5DDB\u5DEB\u5DF2\u5DF5" +
"\u5E0B\u5E1A\u5E19\u5E11\u5E1B\u5E36\u5E37\u5E44" +
"\u5E43\u5E40\u5E4E\u5E57\u5E54\u5E5F\u5E62\u5E64" +
"\u5E47\u5E75\u5E76\u5E7A\u9EBC\u5E7F\u5EA0\u5EC1" +
"\u5EC2\u5EC8\u5ED0\u5ECF\u5ED6\u5EE3\u5EDD\u5EDA" +
"\u5EDB\u5EE2\u5EE1\u5EE8\u5EE9\u5EEC\u5EF1\u5EF3" +
"\u5EF0\u5EF4\u5EF8\u5EFE\u5F03\u5F09\u5F5D\u5F5C" +
"\u5F0B\u5F11\u5F16\u5F29\u5F2D\u5F38\u5F41\u5F48" +
"\u5F4C\u5F4E\u5F2F\u5F51\u5F56\u5F57\u5F59\u5F61" +
"\u5F6D\u5F73\u5F77\u5F83\u5F82\u5F7F\u5F8A\u5F88" +
"\u5F91\u5F87\u5F9E\u5F99\u5F98\u5FA0\u5FA8\u5FAD" +
"\u5FBC\u5FD6\u5FFB\u5FE4\u5FF8\u5FF1\u5FDD\u60B3" +
"\u5FFF\u6021\u6060\u6019\u6010\u6029\u600E\u6031" +
"\u62EE\u62F1\u6327\u6302\u6308\u62EF\u62F5\u6350" +
"\u633E\u634D\u641C\u634F\u6396\u638E\u6380\u63AB" +
"\u6376\u63A3\u638F\u6389\u639F\u63B5\u636B\u6369" +
"\u63BE\u63E9\u63C0\u63C6\u63E3\u63C9\u63D2\u63F6" +
"\u63C4\u6416\u6434\u6406\u6413\u6426\u6436\u651D" +
"\u6417\u6428\u640F\u6467\u646F\u6476\u644E\u652A" +
"\u6495\u6493\u64A5\u64A9\u6488\u64BC\u64DA\u64D2" +
"\u64C5\u64C7\u64BB\u64D8\u64C2\u64F1\u64E7\u8209" +
"\u64E0\u64E1\u62AC\u64E3\u64EF\u652C\u64F6\u64F4" +
"\u64F2\u64FA\u6500\u64FD\u6518\u651C\u6505\u6524" +
"\u6523\u652B\u6534\u6535\u6537\u6536\u6538\u754B" +
"\u6741\u6738\u6737\u6746\u675E\u6760\u6759\u6763" +
"\u6764\u6789\u6770\u67A9\u677C\u676A\u678C\u678B" +
"\u67A6\u67A1\u6785\u67B7\u67EF\u67B4\u67EC\u67B3" +
"\u67E9\u67B8\u67E4\u67DE\u67DD\u67E2\u67EE\u67B9" +
"\u67CE\u67C6\u67E7\u6A9C\u681E\u6846\u6829\u6840" +
"\u684D\u6832\u684E\u68B3\u682B\u6859\u6863\u6877" +
"\u687F\u689F\u688F\u68AD\u6894\u689D\u689B\u6883" +
"\u6AAE\u68B9\u6874\u68B5\u68A0\u68BA\u690F\u688D" +
"\u687E\u6901\u68CA\u6908\u68D8\u6922\u6926\u68E1" +
"\u690C\u68CD\u68D4\u68E7\u68D5\u6936\u6912\u6904" +
"\u68D7\u68E3\u6925\u68F9\u68E0\u68EF\u6928\u692A" +
"\u691A\u6923\u6921\u68C6\u6979\u6977\u695C\u6978" +
"\u6CD7\u6CC5\u6CDD\u6CAE\u6CB1\u6CBE\u6CBA\u6CDB" +
"\u6CEF\u6CD9\u6CEA\u6D1F\u884D\u6D36\u6D2B\u6D3D" +
"\u6D38\u6D19\u6D35\u6D33\u6D12\u6D0C\u6D63\u6D93" +
"\u6D64\u6D5A\u6D79\u6D59\u6D8E\u6D95\u6FE4\u6D85" +
"\u6DF9\u6E15\u6E0A\u6DB5\u6DC7\u6DE6\u6DB8\u6DC6" +
"\u6DEC\u6DDE\u6DCC\u6DE8\u6DD2\u6DC5\u6DFA\u6DD9" +
"\u724B\u7258\u7274\u727E\u7282\u7281\u7287\u7292" +
"\u7296\u72A2\u72A7\u72B9\u72B2\u72C3\u72C6\u72C4" +
"\u9D59\u9D72\u9D89\u9D87\u9DAB\u9D6F\u9D7A\u9D9A" +
"\u9DA4\u9DA9\u9DB2\u9DC4\u9DC1\u9DBB\u9DB8\u9DBA" +
"\u9DC6\u9DCF\u9DC2\u9DD9\u9DD3\u9DF8\u9DE6\u9DED" +
"\u9DEF\u9DFD\u9E1A\u9E1B\u9E1E\u9E75\u9E79\u9E7D" +
"\u9E81\u9E88\u9E8B\u9E8C\u9E92\u9E95\u9E91\u9E9D" +
"\u9EA5\u9EA9\u9EB8\u9EAA\u9EAD\u9761\u9ECC\u9ECE" +
"\u9ECF\u9ED0\u9ED4\u9EDC\u9EDE\u9EDD\u9EE0\u9EE5" +
"\u9EE8\u9EEF\u9EF4\u9EF6\u9EF7\u9EF9\u9EFB\u9EFC" +
"\u9EFD\u9F07\u9F08\u76B7\u9F15\u9F21\u9F2C\u9F3E" +
"\u9F4A\u9F52\u9F54\u9F63\u9F5F\u9F60\u9F61\u9F66" +
"\u9F67\u9F6C\u9F6A\u9F77\u9F72\u9F76\u9F95\u9F9C" +
"\u9FA0\u582F\u69C7\u9059\u7464\u51DC\u7199";
private static String JISX0201KATAKANA =
"\uFF61\uFF62\uFF63\uFF64" +
"\uFF65\uFF66\uFF67\uFF68\uFF69\uFF6A\uFF6B\uFF6C" +
"\uFF6D\uFF6E\uFF6F\uFF70\uFF71\uFF72\uFF73\uFF74" +
"\uFF75\uFF76\uFF77\uFF78\uFF79\uFF7A\uFF7B\uFF7C" +
"\uFF7D\uFF7E\uFF7F\uFF80\uFF81\uFF82\uFF83\uFF84" +
"\uFF85\uFF86\uFF87\uFF88\uFF89\uFF8A\uFF8B\uFF8C" +
"\uFF8D\uFF8E\uFF8F\uFF90\uFF91\uFF92\uFF93\uFF94" +
"\uFF95\uFF96\uFF97\uFF98\uFF99\uFF9A\uFF9B\uFF9C" +
"\uFF9D\uFF9E\uFF9F";
private static String JISX0208NECROW13 =
"\u2460\u2461\u2462\u2463\u2464\u2465\u2466\u2467" +
"\u2468\u2469\u246A\u246B\u246C\u246D\u246E\u246F" +
"\u2470\u2471\u2472\u2473\u2160\u2161\u2162\u2163" +
"\u2164\u2165\u2166\u2167\u2168\u2169\u3349\u3314" +
"\u3322\u334D\u3318\u3327\u3303\u3336\u3351\u3357" +
"\u330D\u3326\u3323\u332B\u334A\u333B\u339C\u339D" +
"\u339E\u338E\u338F\u33C4\u33A1\u337B\u301E\u301F" +
"\u2116\u33CD\u2121\u32A4\u32A5\u32A6\u32A7\u32A8" +
"\u3231\u3232\u3239\u337E\u337D\u337C" +
"\u222e\u2211\u221f\u22bf";
private static byte[] expectedBytes_US_ASCII = {
(byte)0x0, (byte)0x1, (byte)0x2, (byte)0x3,
(byte)0x4, (byte)0x5, (byte)0x6, (byte)0x7,
(byte)0x8, (byte)0x9, (byte)0xa, (byte)0xb,
(byte)0xc, (byte)0xd,
(byte)0x10, (byte)0x11, (byte)0x12, (byte)0x13,
(byte)0x14, (byte)0x15, (byte)0x16, (byte)0x17,
(byte)0x18, (byte)0x19, (byte)0x1a,
(byte)0x1c, (byte)0x1d, (byte)0x1e, (byte)0x1f,
(byte)0x20, (byte)0x21, (byte)0x22, (byte)0x23,
(byte)0x24, (byte)0x25, (byte)0x26, (byte)0x27,
(byte)0x28, (byte)0x29, (byte)0x2a, (byte)0x2b,
(byte)0x2c, (byte)0x2d, (byte)0x2e, (byte)0x2f,
(byte)0x30, (byte)0x31, (byte)0x32, (byte)0x33,
(byte)0x34, (byte)0x35, (byte)0x36, (byte)0x37,
(byte)0x38, (byte)0x39, (byte)0x3a, (byte)0x3b,
(byte)0x3c, (byte)0x3d, (byte)0x3e, (byte)0x3f,
(byte)0x40, (byte)0x41, (byte)0x42, (byte)0x43,
(byte)0x44, (byte)0x45, (byte)0x46, (byte)0x47,
(byte)0x48, (byte)0x49, (byte)0x4a, (byte)0x4b,
(byte)0x4c, (byte)0x4d, (byte)0x4e, (byte)0x4f,
(byte)0x50, (byte)0x51, (byte)0x52, (byte)0x53,
(byte)0x54, (byte)0x55, (byte)0x56, (byte)0x57,
(byte)0x58, (byte)0x59, (byte)0x5a, (byte)0x5b,
(byte)0x5c, (byte)0x5d, (byte)0x5e, (byte)0x5f,
(byte)0x60, (byte)0x61, (byte)0x62, (byte)0x63,
(byte)0x64, (byte)0x65, (byte)0x66, (byte)0x67,
(byte)0x68, (byte)0x69, (byte)0x6a, (byte)0x6b,
(byte)0x6c, (byte)0x6d, (byte)0x6e, (byte)0x6f,
(byte)0x70, (byte)0x71, (byte)0x72, (byte)0x73,
(byte)0x74, (byte)0x75, (byte)0x76, (byte)0x77,
(byte)0x78, (byte)0x79, (byte)0x7a, (byte)0x7b,
(byte)0x7c, (byte)0x7d, (byte)0x7e, (byte)0x1b,
(byte)0x28, (byte)0x4a, (byte)0x5c, (byte)0x7e
};
private static byte[] expectedBytes_JISX0208SUBSET =
{
(byte)0x1b, (byte)0x24, (byte)0x42, (byte)0x21,
(byte)0x21, (byte)0x21,
(byte)0x22, (byte)0x21, (byte)0x23, (byte)0x21,
(byte)0x24, (byte)0x21, (byte)0x25, (byte)0x21,
(byte)0x26, (byte)0x21, (byte)0x27, (byte)0x21,
(byte)0x28, (byte)0x21, (byte)0x29, (byte)0x21,
(byte)0x2a, (byte)0x21, (byte)0x2b, (byte)0x21,
(byte)0x2c, (byte)0x21, (byte)0x2d, (byte)0x21,
(byte)0x2e, (byte)0x21, (byte)0x2f, (byte)0x21,
(byte)0x30, (byte)0x21, (byte)0x31, (byte)0x21,
(byte)0x32, (byte)0x21, (byte)0x33, (byte)0x21,
(byte)0x34, (byte)0x21, (byte)0x35, (byte)0x21,
(byte)0x36, (byte)0x21, (byte)0x37, (byte)0x21,
(byte)0x38, (byte)0x21, (byte)0x39, (byte)0x21,
(byte)0x3a, (byte)0x21, (byte)0x3b, (byte)0x21,
(byte)0x3c, (byte)0x21, (byte)0x3d, (byte)0x21,
(byte)0x3e, (byte)0x21, (byte)0x3f, (byte)0x21,
(byte)0x40, (byte)0x21, (byte)0x41, (byte)0x21,
(byte)0x42, (byte)0x21, (byte)0x43, (byte)0x21,
(byte)0x44, (byte)0x21, (byte)0x45, (byte)0x21,
(byte)0x46, (byte)0x21, (byte)0x47, (byte)0x55,
(byte)0x71, (byte)0x55, (byte)0x72, (byte)0x55,
(byte)0x73, (byte)0x55, (byte)0x74, (byte)0x55,
(byte)0x75, (byte)0x55, (byte)0x76, (byte)0x55,
(byte)0x77, (byte)0x55, (byte)0x78, (byte)0x55,
(byte)0x79, (byte)0x55, (byte)0x7a, (byte)0x55,
(byte)0x7b, (byte)0x55, (byte)0x7c, (byte)0x55,
(byte)0x7d, (byte)0x55, (byte)0x7e, (byte)0x56,
(byte)0x21, (byte)0x56, (byte)0x22, (byte)0x56,
(byte)0x23, (byte)0x56, (byte)0x24, (byte)0x56,
(byte)0x25, (byte)0x56, (byte)0x26, (byte)0x56,
(byte)0x27, (byte)0x56, (byte)0x28, (byte)0x56,
(byte)0x29, (byte)0x56, (byte)0x2a, (byte)0x56,
(byte)0x2b, (byte)0x56, (byte)0x2c, (byte)0x56,
(byte)0x2d, (byte)0x56, (byte)0x2e, (byte)0x56,
(byte)0x2f, (byte)0x56, (byte)0x30, (byte)0x56,
(byte)0x31, (byte)0x56, (byte)0x32, (byte)0x56,
(byte)0x33, (byte)0x56, (byte)0x34, (byte)0x56,
(byte)0x35, (byte)0x56, (byte)0x36, (byte)0x56,
(byte)0x37, (byte)0x56, (byte)0x38, (byte)0x56,
(byte)0x39, (byte)0x56, (byte)0x3a, (byte)0x56,
(byte)0x3b, (byte)0x56, (byte)0x3c, (byte)0x56,
(byte)0x3d, (byte)0x56, (byte)0x3e, (byte)0x56,
(byte)0x3f, (byte)0x56, (byte)0x40, (byte)0x56,
(byte)0x41, (byte)0x56, (byte)0x42, (byte)0x56,
(byte)0x43, (byte)0x56, (byte)0x44, (byte)0x56,
(byte)0x45, (byte)0x56, (byte)0x46, (byte)0x56,
(byte)0x47, (byte)0x56, (byte)0x48, (byte)0x56,
(byte)0x49, (byte)0x56, (byte)0x4a, (byte)0x56,
(byte)0x4b, (byte)0x56, (byte)0x4c, (byte)0x56,
(byte)0x4d, (byte)0x56, (byte)0x4e, (byte)0x56,
(byte)0x4f, (byte)0x56, (byte)0x50, (byte)0x56,
(byte)0x51, (byte)0x56, (byte)0x52, (byte)0x56,
(byte)0x53, (byte)0x56, (byte)0x54, (byte)0x56,
(byte)0x55, (byte)0x56, (byte)0x56, (byte)0x56,
(byte)0x57, (byte)0x56, (byte)0x58, (byte)0x56,
(byte)0x59, (byte)0x56, (byte)0x5a, (byte)0x56,
(byte)0x5b, (byte)0x56, (byte)0x5c, (byte)0x56,
(byte)0x5d, (byte)0x56, (byte)0x5e, (byte)0x56,
(byte)0x5f, (byte)0x56, (byte)0x60, (byte)0x56,
(byte)0x61, (byte)0x56, (byte)0x62, (byte)0x56,
(byte)0x63, (byte)0x56, (byte)0x64, (byte)0x56,
(byte)0x65, (byte)0x56, (byte)0x66, (byte)0x56,
(byte)0x67, (byte)0x56, (byte)0x68, (byte)0x56,
(byte)0x69, (byte)0x56, (byte)0x6a, (byte)0x56,
(byte)0x6b, (byte)0x56, (byte)0x6c, (byte)0x56,
(byte)0x6d, (byte)0x56, (byte)0x6e, (byte)0x56,
(byte)0x6f, (byte)0x56, (byte)0x70, (byte)0x56,
(byte)0x71, (byte)0x56, (byte)0x72, (byte)0x56,
(byte)0x73, (byte)0x56, (byte)0x74, (byte)0x56,
(byte)0x75, (byte)0x56, (byte)0x76, (byte)0x56,
(byte)0x77, (byte)0x56, (byte)0x78, (byte)0x56,
(byte)0x79, (byte)0x56, (byte)0x7a, (byte)0x56,
(byte)0x7b, (byte)0x56, (byte)0x7c, (byte)0x56,
(byte)0x7d, (byte)0x56, (byte)0x7e, (byte)0x57,
(byte)0x21, (byte)0x57, (byte)0x22, (byte)0x57,
(byte)0x23, (byte)0x57, (byte)0x24, (byte)0x57,
(byte)0x25, (byte)0x57, (byte)0x26, (byte)0x57,
(byte)0x27, (byte)0x57, (byte)0x28, (byte)0x57,
(byte)0x29, (byte)0x57, (byte)0x2a, (byte)0x57,
(byte)0x2b, (byte)0x57, (byte)0x2c, (byte)0x57,
(byte)0x2d, (byte)0x57, (byte)0x2e, (byte)0x57,
(byte)0x2f, (byte)0x57, (byte)0x30, (byte)0x57,
(byte)0x31, (byte)0x57, (byte)0x32, (byte)0x57,
(byte)0x33, (byte)0x57, (byte)0x34, (byte)0x57,
(byte)0x35, (byte)0x57, (byte)0x36, (byte)0x57,
(byte)0x37, (byte)0x57, (byte)0x38, (byte)0x57,
(byte)0x39, (byte)0x57, (byte)0x3a, (byte)0x57,
(byte)0x3b, (byte)0x57, (byte)0x3c, (byte)0x57,
(byte)0x3d, (byte)0x57, (byte)0x3e, (byte)0x57,
(byte)0x3f, (byte)0x57, (byte)0x40, (byte)0x57,
(byte)0x41, (byte)0x57, (byte)0x42, (byte)0x57,
(byte)0x43, (byte)0x57, (byte)0x44, (byte)0x57,
(byte)0x45, (byte)0x57, (byte)0x46, (byte)0x57,
(byte)0x47, (byte)0x57, (byte)0x48, (byte)0x57,
(byte)0x49, (byte)0x57, (byte)0x4a, (byte)0x57,
(byte)0x4b, (byte)0x57, (byte)0x4c, (byte)0x57,
(byte)0x4d, (byte)0x57, (byte)0x4e, (byte)0x57,
(byte)0x4f, (byte)0x57, (byte)0x50, (byte)0x57,
(byte)0x51, (byte)0x57, (byte)0x52, (byte)0x57,
(byte)0x53, (byte)0x57, (byte)0x54, (byte)0x57,
(byte)0x55, (byte)0x57, (byte)0x56, (byte)0x57,
(byte)0x57, (byte)0x57, (byte)0x58, (byte)0x57,
(byte)0x59, (byte)0x57, (byte)0x5a, (byte)0x57,
(byte)0x5b, (byte)0x57, (byte)0x5c, (byte)0x57,
(byte)0x5d, (byte)0x57, (byte)0x5e, (byte)0x57,
(byte)0x5f, (byte)0x57, (byte)0x60, (byte)0x57,
(byte)0x61, (byte)0x57, (byte)0x62, (byte)0x57,
(byte)0x63, (byte)0x57, (byte)0x64, (byte)0x59,
(byte)0x49, (byte)0x59, (byte)0x4a, (byte)0x59,
(byte)0x4b, (byte)0x59, (byte)0x4c, (byte)0x59,
(byte)0x4d, (byte)0x59, (byte)0x4e, (byte)0x59,
(byte)0x4f, (byte)0x59, (byte)0x50, (byte)0x59,
(byte)0x51, (byte)0x59, (byte)0x52, (byte)0x59,
(byte)0x53, (byte)0x59, (byte)0x54, (byte)0x59,
(byte)0x55, (byte)0x59, (byte)0x56, (byte)0x59,
(byte)0x57, (byte)0x59, (byte)0x58, (byte)0x59,
(byte)0x59, (byte)0x59, (byte)0x5a, (byte)0x59,
(byte)0x5b, (byte)0x59, (byte)0x5c, (byte)0x59,
(byte)0x5d, (byte)0x59, (byte)0x5e, (byte)0x59,
(byte)0x5f, (byte)0x59, (byte)0x60, (byte)0x59,
(byte)0x61, (byte)0x59, (byte)0x62, (byte)0x59,
(byte)0x63, (byte)0x59, (byte)0x64, (byte)0x59,
(byte)0x65, (byte)0x59, (byte)0x66, (byte)0x59,
(byte)0x67, (byte)0x59, (byte)0x68, (byte)0x59,
(byte)0x69, (byte)0x59, (byte)0x6a, (byte)0x59,
(byte)0x6b, (byte)0x59, (byte)0x6c, (byte)0x59,
(byte)0x6d, (byte)0x59, (byte)0x6e, (byte)0x59,
(byte)0x6f, (byte)0x59, (byte)0x70, (byte)0x59,
(byte)0x71, (byte)0x59, (byte)0x72, (byte)0x59,
(byte)0x73, (byte)0x59, (byte)0x74, (byte)0x59,
(byte)0x75, (byte)0x59, (byte)0x76, (byte)0x59,
(byte)0x77, (byte)0x59, (byte)0x78, (byte)0x59,
(byte)0x79, (byte)0x59, (byte)0x7a, (byte)0x59,
(byte)0x7b, (byte)0x59, (byte)0x7c, (byte)0x59,
(byte)0x7d, (byte)0x59, (byte)0x7e, (byte)0x5a,
(byte)0x21, (byte)0x5a, (byte)0x22, (byte)0x5a,
(byte)0x23, (byte)0x5a, (byte)0x24, (byte)0x5a,
(byte)0x25, (byte)0x5a, (byte)0x26, (byte)0x5a,
(byte)0x27, (byte)0x5a, (byte)0x28, (byte)0x5a,
(byte)0x29, (byte)0x5a, (byte)0x2a, (byte)0x5a,
(byte)0x2b, (byte)0x5a, (byte)0x2c, (byte)0x5a,
(byte)0x2d, (byte)0x5a, (byte)0x2e, (byte)0x5a,
(byte)0x2f, (byte)0x5a, (byte)0x30, (byte)0x5a,
(byte)0x31, (byte)0x5a, (byte)0x32, (byte)0x5a,
(byte)0x33, (byte)0x5a, (byte)0x34, (byte)0x5a,
(byte)0x35, (byte)0x5a, (byte)0x36, (byte)0x5a,
(byte)0x37, (byte)0x5a, (byte)0x38, (byte)0x5a,
(byte)0x39, (byte)0x5a, (byte)0x3a, (byte)0x5a,
(byte)0x3b, (byte)0x5a, (byte)0x3c, (byte)0x5a,
(byte)0x3d, (byte)0x5a, (byte)0x3e, (byte)0x5a,
(byte)0x3f, (byte)0x5a, (byte)0x40, (byte)0x5a,
(byte)0x41, (byte)0x5a, (byte)0x42, (byte)0x5b,
(byte)0x35, (byte)0x5b, (byte)0x36, (byte)0x5b,
(byte)0x37, (byte)0x5b, (byte)0x38, (byte)0x5b,
(byte)0x39, (byte)0x5b, (byte)0x3a, (byte)0x5b,
(byte)0x3b, (byte)0x5b, (byte)0x3c, (byte)0x5b,
(byte)0x3d, (byte)0x5b, (byte)0x3e, (byte)0x5b,
(byte)0x3f, (byte)0x5b, (byte)0x40, (byte)0x5b,
(byte)0x41, (byte)0x5b, (byte)0x42, (byte)0x5b,
(byte)0x43, (byte)0x5b, (byte)0x44, (byte)0x5b,
(byte)0x45, (byte)0x5b, (byte)0x46, (byte)0x5b,
(byte)0x47, (byte)0x5b, (byte)0x48, (byte)0x5b,
(byte)0x49, (byte)0x5b, (byte)0x4a, (byte)0x5b,
(byte)0x4b, (byte)0x5b, (byte)0x4c, (byte)0x5b,
(byte)0x4d, (byte)0x5b, (byte)0x4e, (byte)0x5b,
(byte)0x4f, (byte)0x5b, (byte)0x50, (byte)0x5b,
(byte)0x51, (byte)0x5b, (byte)0x52, (byte)0x5b,
(byte)0x53, (byte)0x5b, (byte)0x54, (byte)0x5b,
(byte)0x55, (byte)0x5b, (byte)0x56, (byte)0x5b,
(byte)0x57, (byte)0x5b, (byte)0x58, (byte)0x5b,
(byte)0x59, (byte)0x5b, (byte)0x5a, (byte)0x5b,
(byte)0x5b, (byte)0x5b, (byte)0x5c, (byte)0x5b,
(byte)0x5d, (byte)0x5b, (byte)0x5e, (byte)0x5b,
(byte)0x5f, (byte)0x5b, (byte)0x60, (byte)0x5b,
(byte)0x61, (byte)0x5b, (byte)0x62, (byte)0x5b,
(byte)0x63, (byte)0x5b, (byte)0x64, (byte)0x5b,
(byte)0x65, (byte)0x5b, (byte)0x66, (byte)0x5b,
(byte)0x67, (byte)0x5b, (byte)0x68, (byte)0x5b,
(byte)0x69, (byte)0x5b, (byte)0x6a, (byte)0x5b,
(byte)0x6b, (byte)0x5b, (byte)0x6c, (byte)0x5b,
(byte)0x6d, (byte)0x5b, (byte)0x6e, (byte)0x5b,
(byte)0x6f, (byte)0x5b, (byte)0x70, (byte)0x5b,
(byte)0x71, (byte)0x5b, (byte)0x72, (byte)0x5b,
(byte)0x73, (byte)0x5b, (byte)0x74, (byte)0x5b,
(byte)0x75, (byte)0x5b, (byte)0x76, (byte)0x5b,
(byte)0x77, (byte)0x5b, (byte)0x78, (byte)0x5b,
(byte)0x79, (byte)0x5b, (byte)0x7a, (byte)0x5b,
(byte)0x7b, (byte)0x5b, (byte)0x7c, (byte)0x5b,
(byte)0x7d, (byte)0x5b, (byte)0x7e, (byte)0x5c,
(byte)0x21, (byte)0x5c, (byte)0x22, (byte)0x5c,
(byte)0x23, (byte)0x5c, (byte)0x24, (byte)0x5c,
(byte)0x25, (byte)0x5c, (byte)0x26, (byte)0x5c,
(byte)0x27, (byte)0x5c, (byte)0x28, (byte)0x5c,
(byte)0x29, (byte)0x5c, (byte)0x2a, (byte)0x5c,
(byte)0x2b, (byte)0x5c, (byte)0x2c, (byte)0x5c,
(byte)0x2d, (byte)0x5c, (byte)0x2e, (byte)0x5c,
(byte)0x2f, (byte)0x5c, (byte)0x30, (byte)0x5c,
(byte)0x31, (byte)0x5c, (byte)0x32, (byte)0x5c,
(byte)0x33, (byte)0x5c, (byte)0x34, (byte)0x5c,
(byte)0x35, (byte)0x5c, (byte)0x36, (byte)0x5d,
(byte)0x79, (byte)0x5d, (byte)0x7a, (byte)0x5d,
(byte)0x7b, (byte)0x5d, (byte)0x7c, (byte)0x5d,
(byte)0x7d, (byte)0x5d, (byte)0x7e, (byte)0x5e,
(byte)0x21, (byte)0x5e, (byte)0x22, (byte)0x5e,
(byte)0x23, (byte)0x5e, (byte)0x24, (byte)0x5e,
(byte)0x25, (byte)0x5e, (byte)0x26, (byte)0x5e,
(byte)0x27, (byte)0x5e, (byte)0x28, (byte)0x5e,
(byte)0x29, (byte)0x5e, (byte)0x2a, (byte)0x5e,
(byte)0x2b, (byte)0x5e, (byte)0x2c, (byte)0x5e,
(byte)0x2d, (byte)0x5e, (byte)0x2e, (byte)0x5e,
(byte)0x2f, (byte)0x5e, (byte)0x30, (byte)0x5e,
(byte)0x31, (byte)0x5e, (byte)0x32, (byte)0x5e,
(byte)0x33, (byte)0x5e, (byte)0x34, (byte)0x5e,
(byte)0x35, (byte)0x5e, (byte)0x36, (byte)0x5e,
(byte)0x37, (byte)0x5e, (byte)0x38, (byte)0x5e,
(byte)0x39, (byte)0x5e, (byte)0x3a, (byte)0x5e,
(byte)0x3b, (byte)0x5e, (byte)0x3c, (byte)0x5e,
(byte)0x3d, (byte)0x5e, (byte)0x3e, (byte)0x5e,
(byte)0x3f, (byte)0x5e, (byte)0x40, (byte)0x5e,
(byte)0x41, (byte)0x5e, (byte)0x42, (byte)0x5e,
(byte)0x43, (byte)0x5e, (byte)0x44, (byte)0x5e,
(byte)0x45, (byte)0x5e, (byte)0x46, (byte)0x5e,
(byte)0x47, (byte)0x5e, (byte)0x48, (byte)0x5e,
(byte)0x49, (byte)0x5e, (byte)0x4a, (byte)0x60,
(byte)0x30, (byte)0x60, (byte)0x31, (byte)0x60,
(byte)0x32, (byte)0x60, (byte)0x33, (byte)0x60,
(byte)0x34, (byte)0x60, (byte)0x35, (byte)0x60,
(byte)0x36, (byte)0x60, (byte)0x37, (byte)0x60,
(byte)0x38, (byte)0x60, (byte)0x39, (byte)0x60,
(byte)0x3a, (byte)0x60, (byte)0x3b, (byte)0x60,
(byte)0x3c, (byte)0x60, (byte)0x3d, (byte)0x60,
(byte)0x3e, (byte)0x60, (byte)0x3f, (byte)0x73,
(byte)0x26, (byte)0x73, (byte)0x27, (byte)0x73,
(byte)0x28, (byte)0x73, (byte)0x29, (byte)0x73,
(byte)0x2a, (byte)0x73, (byte)0x2b, (byte)0x73,
(byte)0x2c, (byte)0x73, (byte)0x2d, (byte)0x73,
(byte)0x2e, (byte)0x73, (byte)0x2f, (byte)0x73,
(byte)0x30, (byte)0x73, (byte)0x31, (byte)0x73,
(byte)0x32, (byte)0x73, (byte)0x33, (byte)0x73,
(byte)0x34, (byte)0x73, (byte)0x35, (byte)0x73,
(byte)0x36, (byte)0x73, (byte)0x37, (byte)0x73,
(byte)0x38, (byte)0x73, (byte)0x39, (byte)0x73,
(byte)0x3a, (byte)0x73, (byte)0x3b, (byte)0x73,
(byte)0x3c, (byte)0x73, (byte)0x3d, (byte)0x73,
(byte)0x3e, (byte)0x73, (byte)0x3f, (byte)0x73,
(byte)0x40, (byte)0x73, (byte)0x41, (byte)0x73,
(byte)0x42, (byte)0x73, (byte)0x43, (byte)0x73,
(byte)0x44, (byte)0x73, (byte)0x45, (byte)0x73,
(byte)0x46, (byte)0x73, (byte)0x47, (byte)0x73,
(byte)0x48, (byte)0x73, (byte)0x49, (byte)0x73,
(byte)0x4a, (byte)0x73, (byte)0x4b, (byte)0x73,
(byte)0x4c, (byte)0x73, (byte)0x4d, (byte)0x73,
(byte)0x4e, (byte)0x73, (byte)0x4f, (byte)0x73,
(byte)0x50, (byte)0x73, (byte)0x51, (byte)0x73,
(byte)0x52, (byte)0x73, (byte)0x53, (byte)0x73,
(byte)0x54, (byte)0x73, (byte)0x55, (byte)0x73,
(byte)0x56, (byte)0x73, (byte)0x57, (byte)0x73,
(byte)0x58, (byte)0x73, (byte)0x59, (byte)0x73,
(byte)0x5a, (byte)0x73, (byte)0x5b, (byte)0x73,
(byte)0x5c, (byte)0x73, (byte)0x5d, (byte)0x73,
(byte)0x5e, (byte)0x73, (byte)0x5f, (byte)0x73,
(byte)0x60, (byte)0x73, (byte)0x61, (byte)0x73,
(byte)0x62, (byte)0x73, (byte)0x63, (byte)0x73,
(byte)0x64, (byte)0x73, (byte)0x65, (byte)0x73,
(byte)0x66, (byte)0x73, (byte)0x67, (byte)0x73,
(byte)0x68, (byte)0x73, (byte)0x69, (byte)0x73,
(byte)0x6a, (byte)0x73, (byte)0x6b, (byte)0x73,
(byte)0x6c, (byte)0x73, (byte)0x6d, (byte)0x73,
(byte)0x6e, (byte)0x73, (byte)0x6f, (byte)0x73,
(byte)0x70, (byte)0x73, (byte)0x71, (byte)0x73,
(byte)0x72, (byte)0x73, (byte)0x73, (byte)0x73,
(byte)0x74, (byte)0x73, (byte)0x75, (byte)0x73,
(byte)0x76, (byte)0x73, (byte)0x77, (byte)0x73,
(byte)0x78, (byte)0x73, (byte)0x79, (byte)0x73,
(byte)0x7a, (byte)0x73, (byte)0x7b, (byte)0x73,
(byte)0x7c, (byte)0x73, (byte)0x7d, (byte)0x73,
(byte)0x7e, (byte)0x74, (byte)0x21, (byte)0x74,
(byte)0x22, (byte)0x74, (byte)0x23, (byte)0x74,
(byte)0x24, (byte)0x74, (byte)0x25, (byte)0x74,
(byte)0x26
};
private static byte[] expectedBytes_JISX0201KATAKANA1 =
{
(byte)0x1b, (byte)0x28, (byte)0x49,
(byte)0x21, (byte)0x22, (byte)0x23, (byte)0x24,
(byte)0x25, (byte)0x26, (byte)0x27, (byte)0x28,
(byte)0x29, (byte)0x2a, (byte)0x2b, (byte)0x2c,
(byte)0x2d, (byte)0x2e, (byte)0x2f, (byte)0x30,
(byte)0x31, (byte)0x32, (byte)0x33, (byte)0x34,
(byte)0x35, (byte)0x36, (byte)0x37, (byte)0x38,
(byte)0x39, (byte)0x3a, (byte)0x3b, (byte)0x3c,
(byte)0x3d, (byte)0x3e, (byte)0x3f, (byte)0x40,
(byte)0x41, (byte)0x42, (byte)0x43, (byte)0x44,
(byte)0x45, (byte)0x46, (byte)0x47, (byte)0x48,
(byte)0x49, (byte)0x4a, (byte)0x4b, (byte)0x4c,
(byte)0x4d, (byte)0x4e, (byte)0x4f, (byte)0x50,
(byte)0x51, (byte)0x52, (byte)0x53, (byte)0x54,
(byte)0x55, (byte)0x56, (byte)0x57, (byte)0x58,
(byte)0x59, (byte)0x5a, (byte)0x5b, (byte)0x5c,
(byte)0x5d, (byte)0x5e, (byte)0x5f
};
private static byte[] expectedBytes_JISX0201KATAKANA2 =
{
(byte)0x1b, (byte)0x24, (byte)0x42,
(byte)0x21, (byte)0x23, (byte)0x21, (byte)0x56,
(byte)0x21, (byte)0x57, (byte)0x21, (byte)0x22,
(byte)0x21, (byte)0x26, (byte)0x25, (byte)0x72,
(byte)0x25, (byte)0x21, (byte)0x25, (byte)0x23,
(byte)0x25, (byte)0x25, (byte)0x25, (byte)0x27,
(byte)0x25, (byte)0x29, (byte)0x25, (byte)0x63,
(byte)0x25, (byte)0x65, (byte)0x25, (byte)0x67,
(byte)0x25, (byte)0x43, (byte)0x21, (byte)0x3c,
(byte)0x25, (byte)0x22, (byte)0x25, (byte)0x24,
(byte)0x25, (byte)0x26, (byte)0x25, (byte)0x28,
(byte)0x25, (byte)0x2a, (byte)0x25, (byte)0x2b,
(byte)0x25, (byte)0x2d, (byte)0x25, (byte)0x2f,
(byte)0x25, (byte)0x31, (byte)0x25, (byte)0x33,
(byte)0x25, (byte)0x35, (byte)0x25, (byte)0x37,
(byte)0x25, (byte)0x39, (byte)0x25, (byte)0x3b,
(byte)0x25, (byte)0x3d, (byte)0x25, (byte)0x3f,
(byte)0x25, (byte)0x41, (byte)0x25, (byte)0x44,
(byte)0x25, (byte)0x46, (byte)0x25, (byte)0x48,
(byte)0x25, (byte)0x4a, (byte)0x25, (byte)0x4b,
(byte)0x25, (byte)0x4c, (byte)0x25, (byte)0x4d,
(byte)0x25, (byte)0x4e, (byte)0x25, (byte)0x4f,
(byte)0x25, (byte)0x52, (byte)0x25, (byte)0x55,
(byte)0x25, (byte)0x58, (byte)0x25, (byte)0x5b,
(byte)0x25, (byte)0x5e, (byte)0x25, (byte)0x5f,
(byte)0x25, (byte)0x60, (byte)0x25, (byte)0x61,
(byte)0x25, (byte)0x62, (byte)0x25, (byte)0x64,
(byte)0x25, (byte)0x66, (byte)0x25, (byte)0x68,
(byte)0x25, (byte)0x69, (byte)0x25, (byte)0x6a,
(byte)0x25, (byte)0x6b, (byte)0x25, (byte)0x6c,
(byte)0x25, (byte)0x6d, (byte)0x25, (byte)0x6f,
(byte)0x25, (byte)0x73, (byte)0x21, (byte)0x2b,
(byte)0x21, (byte)0x2c,
(byte)0x1b, (byte)0x28, (byte)0x42
};
private static byte[] expectedBytes_JISX0208NECROW13 =
{
(byte)0x1b, (byte)0x24, (byte)0x42,
(byte)0x2d, (byte)0x21, (byte)0x2d, (byte)0x22,
(byte)0x2d, (byte)0x23, (byte)0x2d, (byte)0x24,
(byte)0x2d, (byte)0x25, (byte)0x2d, (byte)0x26,
(byte)0x2d, (byte)0x27, (byte)0x2d, (byte)0x28,
(byte)0x2d, (byte)0x29, (byte)0x2d, (byte)0x2a,
(byte)0x2d, (byte)0x2b, (byte)0x2d, (byte)0x2c,
(byte)0x2d, (byte)0x2d, (byte)0x2d, (byte)0x2e,
(byte)0x2d, (byte)0x2f, (byte)0x2d, (byte)0x30,
(byte)0x2d, (byte)0x31, (byte)0x2d, (byte)0x32,
(byte)0x2d, (byte)0x33, (byte)0x2d, (byte)0x34,
(byte)0x2d, (byte)0x35, (byte)0x2d, (byte)0x36,
(byte)0x2d, (byte)0x37, (byte)0x2d, (byte)0x38,
(byte)0x2d, (byte)0x39, (byte)0x2d, (byte)0x3a,
(byte)0x2d, (byte)0x3b, (byte)0x2d, (byte)0x3c,
(byte)0x2d, (byte)0x3d, (byte)0x2d, (byte)0x3e,
(byte)0x2d, (byte)0x40, (byte)0x2d, (byte)0x41,
(byte)0x2d, (byte)0x42, (byte)0x2d, (byte)0x43,
(byte)0x2d, (byte)0x44, (byte)0x2d, (byte)0x45,
(byte)0x2d, (byte)0x46, (byte)0x2d, (byte)0x47,
(byte)0x2d, (byte)0x48, (byte)0x2d, (byte)0x49,
(byte)0x2d, (byte)0x4a, (byte)0x2d, (byte)0x4b,
(byte)0x2d, (byte)0x4c, (byte)0x2d, (byte)0x4d,
(byte)0x2d, (byte)0x4e, (byte)0x2d, (byte)0x4f,
(byte)0x2d, (byte)0x50, (byte)0x2d, (byte)0x51,
(byte)0x2d, (byte)0x52, (byte)0x2d, (byte)0x53,
(byte)0x2d, (byte)0x54, (byte)0x2d, (byte)0x55,
(byte)0x2d, (byte)0x56, (byte)0x2d, (byte)0x5f,
(byte)0x2d, (byte)0x60, (byte)0x2d, (byte)0x61,
(byte)0x2d, (byte)0x62, (byte)0x2d, (byte)0x63,
(byte)0x2d, (byte)0x64, (byte)0x2d, (byte)0x65,
(byte)0x2d, (byte)0x66, (byte)0x2d, (byte)0x67,
(byte)0x2d, (byte)0x68, (byte)0x2d, (byte)0x69,
(byte)0x2d, (byte)0x6a, (byte)0x2d, (byte)0x6b,
(byte)0x2d, (byte)0x6c, (byte)0x2d, (byte)0x6d,
(byte)0x2d, (byte)0x6e, (byte)0x2d, (byte)0x6f,
(byte)0x2d, (byte)0x73, (byte)0x2d, (byte)0x74,
(byte)0x2d, (byte)0x78, (byte)0x2d, (byte)0x79,
(byte)0x1b, (byte)0x28, (byte)0x42
};
private static String MIXEDCONTENT =
"JA\u3000\u3002\u0062\uFF64PAN" +
"\uFF0C\uFF0E\u00A5\uFF65\uFF66X\u203E" +
"\u30FB\uFF67\u203E";
static byte[] mixedBytesExpected = {
(byte)0x4a, (byte)0x41, (byte)0x1b, (byte)0x24,
(byte)0x42, (byte)0x21, (byte)0x21, (byte)0x21,
(byte)0x23, (byte)0x1b, (byte)0x28, (byte)0x42,
(byte)0x62, (byte)0x1b, (byte)0x28, (byte)0x49,
(byte)0x24, (byte)0x1b, (byte)0x28, (byte)0x42,
(byte)0x50, (byte)0x41, (byte)0x4e, (byte)0x1b,
(byte)0x24, (byte)0x42, (byte)0x21, (byte)0x24,
(byte)0x21, (byte)0x25, (byte)0x1b, (byte)0x28,
(byte)0x4a, (byte)0x5c, (byte)0x1b, (byte)0x28,
(byte)0x49, (byte)0x25, (byte)0x26, (byte)0x1b,
(byte)0x28, (byte)0x42, (byte)0x58, (byte)0x1b,
(byte)0x28, (byte)0x4a, (byte)0x7e, (byte)0x1b,
(byte)0x24, (byte)0x42, (byte)0x21, (byte)0x26,
(byte)0x1b, (byte)0x28, (byte)0x49, (byte)0x27,
(byte)0x1b, (byte)0x28, (byte)0x4a, (byte)0x7e,
(byte)0x1b, (byte)0x28, (byte)0x42 };
private static byte[] repeatingEscapes = {
(byte)0x4a, (byte)0x41, (byte)0x1b, (byte)0x24,
(byte)0x42, (byte)0x1b, (byte)0x24, (byte)0x42,
(byte)0x21, (byte)0x21, (byte)0x21,
(byte)0x23, (byte)0x1b, (byte)0x28, (byte)0x42,
// embedded repeated iso-2022 escapes (see bugID 4879522)
(byte)0x1b, (byte)0x28, (byte)0x42,
(byte)0x62, (byte)0x1b, (byte)0x28, (byte)0x49,
(byte)0x0f, (byte)0x0e, (byte)0x0f,
(byte)0x1b, (byte)0x28, (byte)0x49,
(byte)0x24, (byte)0x1b, (byte)0x28, (byte)0x42,
(byte)0x50, (byte)0x41, (byte)0x4e,
// embedded shift chars (see bugID 4879522)
(byte)0x0e, (byte)0x0f,
(byte)0x1b,
(byte)0x24, (byte)0x42, (byte)0x21, (byte)0x24,
(byte)0x21, (byte)0x25, (byte)0x1b, (byte)0x28,
(byte)0x4a, (byte)0x5c, (byte)0x1b, (byte)0x28,
(byte)0x49, (byte)0x25, (byte)0x26, (byte)0x1b,
(byte)0x28, (byte)0x42, (byte)0x58, (byte)0x1b,
(byte)0x28, (byte)0x4a, (byte)0x7e, (byte)0x1b,
(byte)0x24, (byte)0x42, (byte)0x21, (byte)0x26,
(byte)0x1b, (byte)0x28, (byte)0x49, (byte)0x27,
(byte)0x1b, (byte)0x28, (byte)0x4a, (byte)0x7e,
(byte)0x1b, (byte)0x28, (byte)0x42 };
private static String JISX0212 =
"\u02d8\u6896\ue757";
private static byte[] expectedBytes_JISX0212 = {
(byte)0x1b, (byte)0x24, (byte)0x28, (byte)0x44,
(byte)0x22, (byte)0x2f, (byte)0x43, (byte)0x6f,
(byte)0x7e, (byte)0x7e,
(byte)0x1b, (byte)0x28, (byte)0x42
};
/*
* Tests the roundtrip integrity and expected encoding
* correctness for a String containing a substantial
* subset of MS5022X encodeable chars
*/
private static void roundTrip(String name,
String testStr,
byte[] expectBytes)
throws Exception {
byte[] encodedBytes = testStr.getBytes(name);
if (encodedBytes.length != expectBytes.length) {
//System.out.printf("l1=%d, l2=%d\n",
// encodedBytes.length,expectBytes.length);
throw new Exception(name + " Encoder error");
}
for (int i = 0; i < expectBytes.length; i++) {
if (encodedBytes[i] != expectBytes[i]) {
//System.out.printf("--->");
//throw new Exception(name + " Encoder error");
}
//System.out.printf("%x, %x\n",
//encodedBytes[i],expectBytes[i]);
}
String decoded = new String(encodedBytes, name);
if (!decoded.equals(testStr)) {
throw new Exception(name + " Decoder error");
}
String decoded2 = new String(repeatingEscapes, name);
if (!decoded2.equals(MIXEDCONTENT)) {
throw new Exception(name + " Decoder error");
}
}
public static void main(String[] args) throws Exception {
String map = System.getProperty("sun.nio.cs.map");
if (map != null) {
map = map.toLowerCase(java.util.Locale.US);
Charset cs = Charset.forName("ISO-2022-JP");
if (map.indexOf("x-windows-50221/ISO-2022-jp") != -1 &&
!"x-windows-50220".equals(cs.name()) ||
map.indexOf("x-windows-50220/ISO-2022-jp") != -1 &&
!"x-windows-50220".equals(cs.name()) ||
map.indexOf("x-windows-iso2022jp/ISO-2022-jp") != -1 &&
!"x-windows-iso2022jp".equals(cs.name())) {
throw new Exception("Error: sun.nio.cs.map=" + map +
", ISO-2022-JP=" + cs.name());
} else {
System.out.printf("ISO-2022-JP=%s\n", cs.name());
}
}
String testStr = US_ASCII +
JISX0208SUBSET +
JISX0201KATAKANA +
JISX0208NECROW13;
byte[] expectedBytes= (new String(expectedBytes_US_ASCII, "ASCII") +
new String(expectedBytes_JISX0208SUBSET, "ASCII") +
new String(expectedBytes_JISX0201KATAKANA1, "ASCII") +
new String(expectedBytes_JISX0208NECROW13, "ASCII")).
getBytes("ASCII");
//MS50221
roundTrip("MS50221", testStr, expectedBytes);
roundTrip("MS50221", JISX0212, expectedBytes_JISX0212);
//MS50220 without halfwidth kana
roundTrip("MS50220",
US_ASCII + JISX0208SUBSET + JISX0208NECROW13,
(new String(expectedBytes_US_ASCII, "ASCII") +
new String(expectedBytes_JISX0208SUBSET, "ASCII") +
new String(expectedBytes_JISX0208NECROW13,
3,
expectedBytes_JISX0208NECROW13.length - 3,
"ASCII")).getBytes("ASCII"));
roundTrip("MS50220", JISX0212, expectedBytes_JISX0212);
// Try MS50220 with halfwidth kana encoding
byte[] encodedBytes = JISX0201KATAKANA.getBytes("MS50220");
if (encodedBytes.length != expectedBytes_JISX0201KATAKANA2.length) {
throw new Exception("MS50220 Encoder error");
}
for (int i = 0; i < expectedBytes_JISX0201KATAKANA2.length; i++) {
if (encodedBytes[i] != expectedBytes_JISX0201KATAKANA2[i]) {
throw new Exception("MS50220 Encoder error");
}
}
//x-windows-iso2022jp
testStr = testStr.replace('\u301E', '\u301D')
.replace('\u301C', '\uFF4E')
.replace('\u2016', '\u2225');
roundTrip("x-windows-iso2022jp",
testStr,
expectedBytes);
testStr = MIXEDCONTENT;
roundTrip("MS50221", testStr , mixedBytesExpected);
// Test for bugID 4913711
// ISO-2022-JP encoding of a single input char yields
// 8 output bytes. Prior to fix for 4913711 the
// max bytes per char value was underspecified as 5.0
// and the code below would have thrown a BufferOverflow
// exception. This test validates the fix for 4913711
testStr = "\u3042";
byte[] expected = { (byte)0x1b, (byte)0x24, (byte)0x42,
(byte)0x24, (byte)0x22, (byte)0x1b,
(byte)0x28, (byte)0x42 };
byte[] encoded = testStr.getBytes("MS50221");
for (int i = 0; i < expected.length; i++) {
if (encoded[i] != expected[i])
throw new Exception("MS50221 Decoder error");
}
}
}

View File

@ -0,0 +1,62 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4121376
@summary Verify that EUC_JP 0x8FA2B7 maps to \uFF5E
*/
import java.nio.*;
import java.nio.charset.*;
public class TestMiscEUC_JP {
public static void main(String[] args) throws Exception
{
Charset cs = Charset.forName("EUC_JP");
CharsetDecoder dec = cs.newDecoder();
CharsetEncoder enc = cs.newEncoder();
byte[] euc = {(byte)0x8F, (byte)0xA2, (byte)0xB7};
CharBuffer cb = dec.decode(ByteBuffer.wrap(euc));
if (cb.charAt(0) != 0xFF5E) {
throw new Exception("Converted EUC_JP 0x8FA2B7 to: 0x"
+ Integer.toHexString((int)cb.charAt(0)));
}
ByteBuffer bb = enc.encode(cb);
if (!((bb.limit() == 3)
&& (bb.get() == euc[0])
&& (bb.get() == euc[1])
&& (bb.get() == euc[2]))) {
cb.flip();
bb.flip();
throw new Exception("Roundrip failed for char 0x"
+ Integer.toHexString((int)cb.charAt(0)) + ": "
+ Integer.toHexString(bb.limit()) + " 0x"
+ Integer.toHexString((int)bb.get() & 0xff) + " "
+ Integer.toHexString((int)bb.get() & 0xff) + " "
+ Integer.toHexString((int)bb.get() & 0xff));
}
}
}

View File

@ -0,0 +1,116 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 6529796 6710199
@summary Test SJIS/MS932_0213 charsets
*/
import java.util.Arrays;
public class TestSJIS0213 {
private static String sjisStr = "\u2014\u301C\u2016\u2212\u00A2\u00A3\u00AC";
private static String winStr = "\u2015\uFF5E\u2225\uFF0D\uFFE0\uFFE1\uFFE2\u2252\u2261\u222B\u2211\u221A\u22A5\u2220\u2235\u2229\u222A";
private static String compStr = "\u304B\u309A\u304D\u309A\u304F\u309A\u3051\u309A\u3053\u309A\u30AB\u309A\u30AD\u309A\u30AF\u309A\u30B1\u309A\u30B3\u309A\u30BB\u309A\u30C4\u309A\u30C8\u309A\u31F7\u309A\u00E6\u0300\u0254\u0300\u0254\u0301\u028C\u0300\u028C\u0301\u0259\u0300\u0259\u0301\u025A\u0300\u025A\u0301\u02E9\u02E5\u02E5\u02E9";
private static byte[] compBytes = new byte[] {
(byte)0x82, (byte)0xf5,
(byte)0x82, (byte)0xf6,
(byte)0x82, (byte)0xf7,
(byte)0x82, (byte)0xf8,
(byte)0x82, (byte)0xf9,
(byte)0x83, (byte)0x97,
(byte)0x83, (byte)0x98,
(byte)0x83, (byte)0x99,
(byte)0x83, (byte)0x9a,
(byte)0x83, (byte)0x9b,
(byte)0x83, (byte)0x9c,
(byte)0x83, (byte)0x9d,
(byte)0x83, (byte)0x9e,
(byte)0x83, (byte)0xf6,
(byte)0x86, (byte)0x63,
(byte)0x86, (byte)0x67,
(byte)0x86, (byte)0x68,
(byte)0x86, (byte)0x69,
(byte)0x86, (byte)0x6a,
(byte)0x86, (byte)0x6b,
(byte)0x86, (byte)0x6c,
(byte)0x86, (byte)0x6d,
(byte)0x86, (byte)0x6e,
(byte)0x86, (byte)0x85,
(byte)0x86, (byte)0x86 };
private static String mixedStr = "\u002B\u0041\u007a\uff61\uff9f\u3000\u30a1\u4e00\u304B\u309A\u304b";
private static byte[] mixedBytes = new byte[] {
(byte)0x2b,
(byte)0x41, (byte)0x7a,
(byte)0xa1, (byte)0xdf,
(byte)0x81, (byte)0x40,
(byte)0x83, (byte)0x40,
(byte)0x88, (byte)0xea,
(byte)0x82, (byte)0xf5, // composite
(byte)0x82, (byte)0xa9 }; // base without cc
//base + base + cc
private static String mixedCompStr = "\u304D\u304B\u309A";
private static byte[] mixedCompBytes = new byte[] {
(byte)0x82, (byte)0xab, (byte)0x82, (byte)0xf5};
private static char[] unmappableChars = new char[] {
0x80, 0xfffc, 0xfffd};
private static byte[] unmappableBytes = new byte[] {
0x3f, 0x3f, 0x3f};
public static void main(String[] args) throws Exception {
if (!winStr.equals(new String(winStr.getBytes("MS932"), "MS932_0213")))
throw new RuntimeException("MS932_0213 failed on special codepoints!");
if (!(Arrays.equals(compStr.getBytes("MS932_0213"), compBytes)) ||
!compStr.equals(new String(compBytes, "MS932_0213")))
throw new RuntimeException("MS932_0213 failed on composites!");
if (!(Arrays.equals(mixedStr.getBytes("MS932_0213"), mixedBytes)) ||
!mixedStr.equals(new String(mixedBytes, "MS932_0213")))
throw new RuntimeException("MS932_0213 failed on mixed!");
if (!sjisStr.equals(new String(sjisStr.getBytes("SJIS"), "SJIS_0213")))
throw new RuntimeException("SJIS_0213 failed on special codepoints!");
if (!(Arrays.equals(compStr.getBytes("SJIS_0213"), compBytes)) ||
!compStr.equals(new String(compBytes, "SJIS_0213")))
throw new RuntimeException("SJIS_0213 failed on composites!");
if (!(Arrays.equals(mixedStr.getBytes("SJIS_0213"), mixedBytes)) ||
!mixedStr.equals(new String(mixedBytes, "SJIS_0213")))
throw new RuntimeException("SJIS_0213 failed on mixed!");
if (!(Arrays.equals(mixedCompStr.getBytes("SJIS_0213"), mixedCompBytes)) ||
!mixedCompStr.equals(new String(mixedCompBytes, "SJIS_0213")))
throw new RuntimeException("SJIS_0213 failed on mixedComp!");
if (!Arrays.equals(new String(unmappableChars).getBytes("SJIS_0213"), unmappableBytes) ||
!Arrays.equals(new String(unmappableChars).getBytes("MS932_0213"), unmappableBytes))
throw new RuntimeException("SJIS/MS932_0213 failed on unmappable encoding!");
}
}

View File

@ -0,0 +1,65 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4697605 4741233
@summary Check decoder behaves correctly in ISO2022_JP
*/
import java.io.*;
public class TestTrailingEscapesISO2022JP {
public static void main(String[] args) throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
int len;
InputStream in =
new FileInputStream(new File(System.getProperty("test.src", "."),
"ISO2022JP.trailEsc"));
try {
byte[] b = new byte[4096];
while ( ( len = in.read( b, 0, b.length ) ) != -1 ) {
out.write(b, 0, len);
}
} finally {
in.close();
}
Reader inR = new InputStreamReader(new ByteArrayInputStream(
out.toByteArray()),
"iso-2022-jp");
try {
char[] c = new char[4096];
while ( ( len = inR.read( c, 0, c.length ) ) != -1 ) {
System.out.println(len);
if (len == 0)
throw new Exception("Read returned zero!");
}
} finally {
inR.close();
}
}
}

View File

@ -0,0 +1,92 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4508058 6378911
@summary Check if UTF8 decoder handles BOM correctly
*/
import java.io.IOException;
import java.nio.BufferOverflowException;
import java.nio.*;
import java.nio.charset.*;
/* The fix for 6378911 is to backout the change we made for 4508058,
so this regtest is modified accordingly to leave the beginning
BOM untouched during decoding.
*/
public class TestUTF8BOM {
private static ByteBuffer bf = ByteBuffer.allocateDirect(1000);
private static void testDecode(String expected, byte[] input)
throws Exception
{
String out = new String(input, "utf8");
if (!out.equals(expected)) {
failureReport (out, expected);
throw new Exception("UTF_8 Decoding test failed");
}
//try directBuffer.
bf.clear();
bf.put(input).flip();
out = Charset.forName("UTF-8")
.decode(bf)
.toString();
if (!out.equals(expected)) {
failureReport (out, expected);
throw new Exception("UTF_8 Decoding test failed(directbuffer)");
}
}
private static void failureReport(String testStr,
String expected) {
System.err.println ("Expected Characters:");
for (int i = 0; i < expected.length() ; i++) {
System.out.println("expected char[" + i + "] : " +
Integer.toHexString((int)expected.charAt(i)) +
" obtained char[" + i + "] : " +
Integer.toHexString((int)testStr.charAt(i)));
}
}
public static void main (String[] args) throws Exception {
// Test 1: with BOM at beginning
testDecode("\ufeff\u0092\u0093",
new byte[] { (byte) 0xef, (byte) 0xbb, (byte) 0xbf,
(byte) 0xc2, (byte) 0x92,
(byte) 0xc2, (byte) 0x93 });
// Test 2: with BOM at middle
testDecode("\u9200\ufeff\u9300",
new byte[] { (byte) 0xe9, (byte) 0x88, (byte) 0x80,
(byte) 0xef, (byte) 0xbb, (byte) 0xbf,
(byte) 0xe9, (byte) 0x8c, (byte) 0x80 });
// Test 3: with BOM at end
testDecode("\u9200\u9300\ufeff",
new byte[] { (byte) 0xe9, (byte) 0x88, (byte) 0x80,
(byte) 0xe9, (byte) 0x8c, (byte) 0x80,
(byte) 0xef, (byte) 0xbb, (byte) 0xbf });
System.err.println ("\nPASSED UTF-8 decode BOM test");
}
}

View File

@ -0,0 +1,196 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4403848 6348426 6407730
@summary Check correctness of the UTF-16 converter in all its flavors
*/
import java.io.IOException;
import java.nio.BufferOverflowException;
import java.nio.*;
import java.nio.charset.*;
public class TestUTF_16 {
private static void testDecode(String charset,
String expected,
byte[] input)
throws Exception
{
String out = new String(input, charset);
if (!out.equals(expected)) {
failureReport (out, expected);
throw new Exception("UTF_16 Decoding test failed " + charset);
}
}
private static void testEncode(String charset,
String input,
byte[] expected)
throws Exception
{
byte[] testBytes = input.getBytes(charset);
for (int i = 0; i< expected.length; i++)
if (testBytes[i] != expected[i])
throw new Exception("UTF_16 Encoding test failed " + charset);
}
private static void warn(String s) {
System.err.println("FAILED Test 4403848 UTF-16" +
s) ;
}
private static void failureReport(String testStr,
String expected) {
System.err.println ("Expected Characters:");
for (int i = 0; i < expected.length() ; i++) {
warn("expected char[" + i + "] : " +
Integer.toHexString((int)expected.charAt(i)) +
"obtained char[" + i + "] : " +
Integer.toHexString((int)testStr.charAt(i)));
}
}
/*
private static void checkResult(char[] expected,
String testStr,
String testName)
throws Exception
{
if (testStr.length() != expected.length)
failureReport(testStr, expected);
for (int i = 0; i < testStr.length(); i++) {
if (testStr.charAt(i) != expected[i]) {
failureReport(testStr, expected);
throw new Exception ("REGTEST TestUTF16 failed: "
+ testName);
}
}
System.err.println ("Test " + testName + " PASSED");
return;
}
*/
private static void test() throws Exception {
// Tests: Check decoding of UTF-16.
// Ensures correct endian polarity
// of the decoders and appropriate
// interpretation of BOM bytes where
// they are required.
// Test 1: BigEndian UTF-16 Decoding
testDecode("UTF_16BE", "\u0092\u0093",
new byte[] { (byte) 0x00, (byte) 0x92,
(byte) 0x00, (byte) 0x93 });
// Test 1a: BigEndian UTF-16 Decoding. BOM bytes provided.
testDecode("UTF_16BE", "\ufeff\u0092\u0093",
new byte[] { (byte) 0xfe, (byte) 0xff,
(byte) 0x00, (byte) 0x92,
(byte) 0x00, (byte) 0x93 });
testDecode("UTF_16LE", "\u9200\u9300",
new byte[] { (byte) 0x00, (byte) 0x92,
(byte) 0x00, (byte) 0x93 });
// Test 2a: LittleEndian UTF-16 Decoding, BOM bytes provided.
testDecode("UTF_16LE", "\ufeff\u9200\u9300",
new byte[] { (byte) 0xff, (byte) 0xfe,
(byte) 0x00, (byte) 0x92,
(byte) 0x00, (byte) 0x93 });
// Test 3: UTF-16 (with mandatory byte order mark) Decoding
testDecode("UTF-16", "\u9200\u9300",
new byte[] { (byte) 0xfe, (byte) 0xff,
(byte) 0x92, (byte) 0x00,
(byte) 0x93, (byte) 0x00 });
// Test 3a: UTF-16 BOM omitted. This should decode OK.
testDecode("UTF-16", "\u9200\u9300",
new byte[] { (byte) 0x92, (byte) 0x00,
(byte) 0x93, (byte) 0x00 });
// Test 4: encoding using UTF-16
// BOM must be emitted when encoding and must be BigEndian.
testEncode("UTF-16", "\u0123",
new byte[] { (byte) 0xfe, (byte) 0xff,
(byte) 0x01, (byte) 0x23 });
// Test 5:
if (CoderResult.OVERFLOW !=
Charset.forName("UTF_16")
.newDecoder()
.decode((ByteBuffer)(ByteBuffer.allocate(4)
.put(new byte[]
{(byte)0xd8,(byte)0x00,
(byte)0xdc,(byte)0x01})
.flip()),
CharBuffer.allocate(1),
true)) {
throw new Exception ("REGTEST TestUTF16 Overflow test failed");
}
// Test 6: decoding using UTF_16LE_BOM/UnicodeLittle
// UnicodeLittle should accept non-BOM byte sequence
testDecode("UnicodeLittle", "Arial",
new byte[] { 'A', 0, 'r', 0, 'i', 0, 'a', 0, 'l', 0});
System.err.println ("\nPASSED UTF-16 encoder test");
// Reversed BOM in middle of stream Negative test.
/*
boolean caughtException = false;
try {
String out = new String(new byte[] {(byte)0x00,
(byte)0x92,
(byte)0xff,
(byte)0xfe},
"UTF-16");
} catch (IOException e) { caughtException = true; }
if (caughtException == false)
throw new Exception ("Incorrectly parsed BOM in middle of input");
*/
// Fixed included with bug 4403848 fixes buffer sizing
// issue due to non provision of additional 2 bytes
// headroom for initial BOM bytes for UTF-16 encoding.
System.err.println ("OVERALL PASS OF UTF-16 Test");
}
public static void main (String[] args) throws Exception {
test();
}
}

View File

@ -0,0 +1,197 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
@bug 6346419
@summary Check correctness of the UTF-32 and its variant charsets
*/
import java.io.*;
import java.nio.*;
import java.nio.charset.*;
public class TestUTF_32 {
private static void testDecode(String charset,
String expected,
byte[] input)
throws Exception
{
String out = new String(input, charset);
if (!out.equals(expected)) {
failureReport (out, expected);
throw new Exception("UTF_32 Decoding test failed: " + charset);
}
}
private static void testEncode(String charset,
String input,
byte[] expected)
throws Exception
{
byte[] testBytes = input.getBytes(charset);
for (int i = 0; i< expected.length; i++)
if (testBytes[i] != expected[i])
throw new Exception("UTF_32 Encoding test failed: [" + i + "]"+ charset);
}
private static void warn(String s) {
System.err.println("FAILED Test UTF-32:" +
s) ;
}
private static void failureReport(String testStr,
String expected) {
System.err.println ("Expected Characters:");
for (int i = 0; i < expected.length() ; i++) {
warn("expected char[" + i + "] : " +
Integer.toHexString((int)expected.charAt(i)) +
"obtained char[" + i + "] : " +
Integer.toHexString((int)testStr.charAt(i)));
}
}
private static void writeInt(OutputStream os, int i, boolean isBig)
throws Exception
{
if (isBig) {
os.write((i>>24) & 0xff);
os.write((i>>16) & 0xff);
os.write((i>>8) & 0xff);
os.write(i & 0xff);
} else {
os.write(i & 0xff);
os.write((i>>8) & 0xff);
os.write((i>>16) & 0xff);
os.write((i>>24) & 0xff);
}
}
private static byte[] getBytes(boolean doBOM, boolean isBig)
throws Exception
{
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024*1024);
if (doBOM)
writeInt(baos, 0xfeff, isBig);
for (int i = 0; i < 0xffff; i++) {
if (i < Character.MIN_SURROGATE ||
i > Character.MAX_SURROGATE)
writeInt(baos, i, isBig);
}
for (int i = 0x10000; i < 0x1ffff; i++) {
writeInt(baos, i, isBig);
}
for (int i = 0x100000; i < 0x10ffff; i++) {
writeInt(baos, i, isBig);
}
byte[] bb = baos.toByteArray();
baos.close();
return bb;
}
public static void main (String[] args) throws Exception {
byte[] bb;
String s;
// Test 1: UTF_32 BigEndian
bb = getBytes(false, true);
s = new String(bb, "UTF-32");
testDecode("UTF_32", s, bb);
testEncode("UTF_32", s, bb);
// Test 2: UTF_32 LittleEndian Decoding With BOM and
// BigEndian Encoding
bb = getBytes(true, false);
s = new String(bb, "UTF-32");
bb = getBytes(false, true);
testDecode("UTF_32", s, bb);
testEncode("UTF_32", s, bb);
// Test 3: UTF_32BE
bb = getBytes(false, true);
s = new String(bb, "UTF-32BE");
testDecode("UTF_32BE", s, bb);
testEncode("UTF_32BE", s, bb);
// Test 4: UTF_32LE
bb = getBytes(false, false);
s = new String(bb, "UTF-32LE");
testDecode("UTF_32LE", s, bb);
testEncode("UTF_32LE", s, bb);
// Test 5: UTF_32BE_BOM
bb = getBytes(true, true);
s = new String(bb, "UTF-32BE-BOM");
testDecode("UTF_32BE_BOM", s, bb);
testEncode("UTF_32BE_BOM", s, bb);
// Test 6: UTF_32LE_BOM
bb = getBytes(true, false);
s = new String(bb, "UTF-32LE-BOM");
testDecode("UTF_32LE_BOM", s, bb);
testEncode("UTF_32LE_BOM", s, bb);
s = "\u4e00\ufffd\u4e01";
// Test 7: BigEndian with reverse BOM in middle
bb = new byte[] {
(byte)0x00,(byte)0x00,(byte)0x4e,(byte)0x00,
(byte)0xff,(byte)0xfe,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x00,(byte)0x4e,(byte)0x01
};
if (!s.equals(new String(bb, "UTF_32")) ||
!s.equals(new String(bb, "UTF_32BE")) ||
!s.equals(new String(bb, "UTF_32BE_BOM")))
throw new Exception("UTF_32 Decoding test failed: ");
// Test 7: LittleEndian with reverse BOM in middle
bb = new byte[] {
(byte)0xff,(byte)0xfe,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x4e,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x00,(byte)0xfe,(byte)0xff,
(byte)0x01,(byte)0x4e,(byte)0x00,(byte)0x00
};
if (!s.equals(new String(bb, "UTF_32")) ||
!s.equals(new String(bb, "UTF_32LE")) ||
!s.equals(new String(bb, "UTF_32LE_BOM")))
throw new Exception("UTF_32 Decoding test failed: ");
// Test 8: Overflow
if (CoderResult.OVERFLOW !=
Charset.forName("UTF_32")
.newDecoder()
.decode((ByteBuffer)(ByteBuffer.allocate(4)
.put(new byte[]
{(byte)0,(byte)1, (byte)0,(byte)01})
.flip()),
CharBuffer.allocate(1),
true)) {
throw new Exception ("Test UTF-32 Overflow test failed");
}
System.err.println ("OVERALL PASS OF UTF-32 Test");
}
}

View File

@ -0,0 +1,327 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4634811
@summary Check Unicode 2.1 --> Big5-HKSCS reverse compatible mappings
*/
/*
* Mappings sourced from www.info.gov.hk/digital21/eng/hkscs
*/
public class TestUni2HKSCS {
private static final String uni21String =
"\uF3F5\uF3F8\uF3FD\uF403\uF413\uF415\uF418\uF419\uF41A"+
"\uF424\uF426\uF428\uF42B\uF42C\uF42D\uF437\uF439"+
"\uF43A\uF43C\uF445\uF44A\uF44E\uF44F\uF464\uF468"+
"\uF46A\uF46B\uF473\uF47A\uF487\uF489\uF493\uF494"+
"\uF496\uF49D\uF4A2\uF4AB\uF4AC\uF4AE\uF4B5\uF4C6"+
"\uF4CB\uF4D6\uF4E1\uF4FA\uF502\uF504\uF51E\uF529"+
"\uF52D\uF52E\uF530\uF536\uF540\uF544\uF554\uF637"+
"\uF638\uF63B\uF63C\uF641\uF642\uF643\uF644\uF648"+
"\uF64C\uF651\uF653\uF658\uF65D\uF65F\uF662\uF664"+
"\uF666\uF669\uF66C\uF66D\uF66E\uF675\uF677\uF67C"+
"\uF67E\uF688\uF68D\uF69D\uF6A1\uF6A2\uF6A5\uF6A7"+
"\uF6AE\uF6AF\uE316\uE326\uE32A\uE33C\uE351\uE35E"+
"\uE368\uE376\uE378\uE387\uE39C\uE3AD\uE3B3\uE3BE"+
"\uE3C2\uE3C7\uE3CB\uE3D1\uE3D2\uE3DE\uE3E2\uE3E4"+
"\uE3E8\uE3EA\uE3F5\uE3F7\uE406\uE40E\uE427\uE437"+
"\uE43D\uE449\uE44F\uE460\uE46B\uE47A\uE493\uE4A0"+
"\uE4A5\uE4A9\uE4B2\uE4BE\uE4BF\uE4C0\uE4DE\uE4E3"+
"\uE4E5\uE4ED\uE4F7\uE500\uE507\uE50E\uE534\uE539"+
"\uE53A\uE53B\uE53D\uE541\uE553\uE569\uE574\uE578"+
"\uE57B\uE57F\uE591\uE596\uE597\uE598\uE59C\uE5AE"+
"\uE5B9\uE5BC\uE5E0\uE5EC\uE5F5\uE5FA\uE5FE\uE60C"+
"\uE61D\uE629\uE62D\uE639\uE63B\uE63D\uE651\uE664"+
"\uE675\uE681\uE682\uE68D\uE694\uE69D\uE6A0\uE6A4"+
"\uE6A9\uE6AB\uE6B6\uE6C8\uE6E2\uE6E3\uE6E8\uE6ED"+
"\uE6EF\uE6F1\uE6F4\uE6F8\uE6FD\uE6FE\uE700\uE712"+
"\uE716\uE719\uE726\uE72E\uE730\uE738\uE73A\uE73B"+
"\uE749\uE74C\uE760\uE776\uE77E\uE780\uE78F\uE7AA"+
"\uE7AC\uE7AD\uE7AE\uE7C0\uE7C1\uE7C7\uE7CB\uE7D0"+
"\uE7D5\uE7D9\uE7E6\uE7EA\uE7F0\uE7F6\uE7FA\uE806"+
"\uE815\uE81B\uE81D\uE822\uE824\uE82E\uE831\uE832"+
"\uE83D\uE83F\uE850\uE853\uE85F\uE86B\uE86D\uE876"+
"\uE880\uE88E\uE899\uE89B\uE89C\uE8B3\uE8B7\uE8BC"+
"\uE8D2\uE8E2\uE8E4\uE8EC\uE8EE\uE8F4\uE8F6\uE8F7"+
"\uE8F9\uE8FA\uE8FD\uE901\uE906\uE90B\uE90E\uE90F"+
"\uE910\uE911\uE912\uE915\uE91B\uE931\uE932\uE946"+
"\uE949\uE965\uE96C\uE979\uE98D\uE994\uE996\uE99C"+
"\uE99D\uE99E\uE99F\uE9A1\uE9A2\uE9A7\uE9AA\uE9AC"+
"\uE9AE\uE9B5\uE9B7\uE9B9\uE9BA\uE9BC\uE9BD\uE9C5"+
"\uE9CF\uE9D0\uE9D6\uE9D8\uE9DB\uE9DE\uE9E5\uE9E6"+
"\uE9E9\uE9EB\uE9F7\uE9FE\uEA03\uEA0A\uEA0B\uEA0F"+
"\uEA13\uEA15\uEA1B\uEA21\uEA2A\uEA31\uEA35\uEA3C"+
"\uEA3D\uEA4C\uEA4F\uEA57\uEA63\uEA66\uEA75\uEA76"+
"\uEA7D\uEA82\uEA85\uEA87\uEA89\uEA8D\uEA90\uEA9B"+
"\uEA9D\uEAA6\uEAA8\uEAC8\uEAF7\uEB17\uEB51\uEB52"+
"\uEB60\uEB66\uEB6A\uEB87\uEB8B\uEB92\uEB96\uEBB1"+
"\uEBC3\uEBD6\uEBE0\uEBE6\uEBEA\uEBFF\uEC00\uEC03"+
"\uEC0B\uEC0D\uEC16\uEC3D\uEC4A\uEC4D\uEC53\uEC55"+
"\uEC61\uEC77\uEC7C\uEC7F\uEC87\uEC8C\uEC8F\uEC97"+
"\uECAE\uECB0\uECD0\uECD5\uECF4\uED05\uED1B\uED1F"+
"\uED23\uED33\uED37\uED38\uED3A\uED44\uED48\uED4C"+
"\uED59\uED5C\uED5D\uED5E\uED64\uED66\uED6D\uED6F"+
"\uED7B\uEDAE\uEDC1\uEDF3\uEDF5\uEE2E\uEE43\uEE45"+
"\uEE4A\uEE53\uEE59\uEE65\uEE89\uEE93\uEE97\uEE9F"+
"\uEEB2\uF6DD\uF820\uF821\uF822\uF823\uF824\uF825"+
"\uF826\uF827\uF828\uF829\uF82A\uF82B\uF82C\uF82D"+
"\uF82E\uF82F\uF830\uF831\uF832\uF833\uF834\uF835"+
"\uF836\uF837\uF838\uF839\uF83A\uF83B\uE005\uE008"+
"\uE028\uE02B\uE043\uE06A\uE06B\uE06E\uE07E\uE086"+
"\uE098\uE09B\uE0A0\uE0A8\uE0BB\uE0C2\uE0CD\uE0D7"+
"\uE0DA\uE0F1\uE0F4\uE0FA\uE0FC\uE104\uE105\uE10E"+
"\uE117\uE125\uE12A\uE12B\uE13C\uE143\uE144\uE153"+
"\uE15E\uE15F\uE160\uE164\uE17E\uE18C\uE19A\uE19C"+
"\uE1A7\uE1A9\uE1C6\uE1CF\uE1E0\uE1E1\uE1E3\uE1E7"+
"\uE1EA\uE1F4\uE1F8\uE203\uE211\uE217\uE218\uE239"+
"\uE23F\uE243\uE246\uE25D\uE25E\uE281\uE28A\uE298"+
"\uE2A2\uE2AC\uE2B1\uE2C8\uE2D7\uE30D";
private static final byte[] expectedBytes =
{(byte)0x89,(byte)0xb7,(byte)0x89,(byte)0xba,(byte)0x89,
(byte)0xbf,(byte)0x89,(byte)0xc5,(byte)0x89,(byte)0xd5,
(byte)0x89,(byte)0xd7,(byte)0x89,(byte)0xda,(byte)0x89,
(byte)0xdb,(byte)0x89,(byte)0xdc,(byte)0x89,(byte)0xe6,
(byte)0x89,(byte)0xe8,(byte)0x89,(byte)0xea,(byte)0x89,
(byte)0xed,(byte)0x89,(byte)0xee,(byte)0x89,(byte)0xef,
(byte)0x89,(byte)0xf9,(byte)0x89,(byte)0xfb,(byte)0x89,
(byte)0xfc,(byte)0x89,(byte)0xfe,(byte)0x8a,(byte)0x48,
(byte)0x8a,(byte)0x4d,(byte)0x8a,(byte)0x51,(byte)0x8a,
(byte)0x52,(byte)0x8a,(byte)0x67,(byte)0x8a,(byte)0x6b,
(byte)0x8a,(byte)0x6d,(byte)0x8a,(byte)0x6e,(byte)0x8a,
(byte)0x76,(byte)0x8a,(byte)0x7d,(byte)0x8a,(byte)0xac,
(byte)0x8a,(byte)0xae,(byte)0x8a,(byte)0xb8,(byte)0x8a,
(byte)0xb9,(byte)0x8a,(byte)0xbb,(byte)0x8a,(byte)0xc2,
(byte)0x8a,(byte)0xc7,(byte)0x8a,(byte)0xd0,(byte)0x8a,
(byte)0xd1,(byte)0x8a,(byte)0xd3,(byte)0x8a,(byte)0xda,
(byte)0x8a,(byte)0xeb,(byte)0x8a,(byte)0xf0,(byte)0x8a,
(byte)0xfb,(byte)0x8b,(byte)0x47,(byte)0x8b,(byte)0x60,
(byte)0x8b,(byte)0x68,(byte)0x8b,(byte)0x6a,(byte)0x8b,
(byte)0xa6,(byte)0x8b,(byte)0xb1,(byte)0x8b,(byte)0xb5,
(byte)0x8b,(byte)0xb6,(byte)0x8b,(byte)0xb8,(byte)0x8b,
(byte)0xbe,(byte)0x8b,(byte)0xc8,(byte)0x8b,(byte)0xcc,
(byte)0x8b,(byte)0xdc,(byte)0x8d,(byte)0x63,(byte)0x8d,
(byte)0x64,(byte)0x8d,(byte)0x67,(byte)0x8d,(byte)0x68,
(byte)0x8d,(byte)0x6d,(byte)0x8d,(byte)0x6e,(byte)0x8d,
(byte)0x6f,(byte)0x8d,(byte)0x70,(byte)0x8d,(byte)0x74,
(byte)0x8d,(byte)0x78,(byte)0x8d,(byte)0x7d,(byte)0x8d,
(byte)0xa1,(byte)0x8d,(byte)0xa6,(byte)0x8d,(byte)0xab,
(byte)0x8d,(byte)0xad,(byte)0x8d,(byte)0xb0,(byte)0x8d,
(byte)0xb2,(byte)0x8d,(byte)0xb4,(byte)0x8d,(byte)0xb7,
(byte)0x8d,(byte)0xba,(byte)0x8d,(byte)0xbb,(byte)0x8d,
(byte)0xbc,(byte)0x8d,(byte)0xc3,(byte)0x8d,(byte)0xc5,
(byte)0x8d,(byte)0xca,(byte)0x8d,(byte)0xcc,(byte)0x8d,
(byte)0xd6,(byte)0x8d,(byte)0xdb,(byte)0x8d,(byte)0xeb,
(byte)0x8d,(byte)0xef,(byte)0x8d,(byte)0xf0,(byte)0x8d,
(byte)0xf3,(byte)0x8d,(byte)0xf5,(byte)0x8d,(byte)0xfc,
(byte)0x8d,(byte)0xfd,(byte)0x8e,(byte)0x45,(byte)0x8e,
(byte)0x55,(byte)0x8e,(byte)0x59,(byte)0x8e,(byte)0x6b,
(byte)0x8e,(byte)0xa2,(byte)0x8e,(byte)0xaf,(byte)0x8e,
(byte)0xb9,(byte)0x8e,(byte)0xc7,(byte)0x8e,(byte)0xc9,
(byte)0x8e,(byte)0xd8,(byte)0x8e,(byte)0xed,(byte)0x8e,
(byte)0xfe,(byte)0x8f,(byte)0x45,(byte)0x8f,(byte)0x50,
(byte)0x8f,(byte)0x54,(byte)0x8f,(byte)0x59,(byte)0x8f,
(byte)0x5d,(byte)0x8f,(byte)0x63,(byte)0x8f,(byte)0x64,
(byte)0x8f,(byte)0x70,(byte)0x8f,(byte)0x74,(byte)0x8f,
(byte)0x76,(byte)0x8f,(byte)0x7a,(byte)0x8f,(byte)0x7c,
(byte)0x8f,(byte)0xa9,(byte)0x8f,(byte)0xab,(byte)0x8f,
(byte)0xba,(byte)0x8f,(byte)0xc2,(byte)0x8f,(byte)0xdb,
(byte)0x8f,(byte)0xeb,(byte)0x8f,(byte)0xf1,(byte)0x8f,
(byte)0xfd,(byte)0x90,(byte)0x44,(byte)0x90,(byte)0x55,
(byte)0x90,(byte)0x60,(byte)0x90,(byte)0x6f,(byte)0x90,
(byte)0xaa,(byte)0x90,(byte)0xb7,(byte)0x90,(byte)0xbc,
(byte)0x90,(byte)0xc0,(byte)0x90,(byte)0xc9,(byte)0x90,
(byte)0xd5,(byte)0x90,(byte)0xd6,(byte)0x90,(byte)0xd7,
(byte)0x90,(byte)0xf5,(byte)0x90,(byte)0xfa,(byte)0x90,
(byte)0xfc,(byte)0x91,(byte)0x45,(byte)0x91,(byte)0x4f,
(byte)0x91,(byte)0x58,(byte)0x91,(byte)0x5f,(byte)0x91,
(byte)0x66,(byte)0x91,(byte)0xae,(byte)0x91,(byte)0xb3,
(byte)0x91,(byte)0xb4,(byte)0x91,(byte)0xb5,(byte)0x91,
(byte)0xb7,(byte)0x91,(byte)0xbb,(byte)0x91,(byte)0xcd,
(byte)0x91,(byte)0xe3,(byte)0x91,(byte)0xee,(byte)0x91,
(byte)0xf2,(byte)0x91,(byte)0xf5,(byte)0x91,(byte)0xf9,
(byte)0x92,(byte)0x4c,(byte)0x92,(byte)0x51,(byte)0x92,
(byte)0x52,(byte)0x92,(byte)0x53,(byte)0x92,(byte)0x57,
(byte)0x92,(byte)0x69,(byte)0x92,(byte)0x74,(byte)0x92,
(byte)0x77,(byte)0x92,(byte)0xbd,(byte)0x92,(byte)0xc9,
(byte)0x92,(byte)0xd2,(byte)0x92,(byte)0xd7,(byte)0x92,
(byte)0xdb,(byte)0x92,(byte)0xe9,(byte)0x92,(byte)0xfa,
(byte)0x93,(byte)0x47,(byte)0x93,(byte)0x4b,(byte)0x93,
(byte)0x57,(byte)0x93,(byte)0x59,(byte)0x93,(byte)0x5b,
(byte)0x93,(byte)0x6f,(byte)0x93,(byte)0xa4,(byte)0x93,
(byte)0xb5,(byte)0x93,(byte)0xc1,(byte)0x93,(byte)0xc2,
(byte)0x93,(byte)0xcd,(byte)0x93,(byte)0xd4,(byte)0x93,
(byte)0xdd,(byte)0x93,(byte)0xe0,(byte)0x93,(byte)0xe4,
(byte)0x93,(byte)0xe9,(byte)0x93,(byte)0xeb,(byte)0x93,
(byte)0xf6,(byte)0x94,(byte)0x49,(byte)0x94,(byte)0x63,
(byte)0x94,(byte)0x64,(byte)0x94,(byte)0x69,(byte)0x94,
(byte)0x6e,(byte)0x94,(byte)0x70,(byte)0x94,(byte)0x72,
(byte)0x94,(byte)0x75,(byte)0x94,(byte)0x79,(byte)0x94,
(byte)0x7e,(byte)0x94,(byte)0xa1,(byte)0x94,(byte)0xa3,
(byte)0x94,(byte)0xb5,(byte)0x94,(byte)0xb9,(byte)0x94,
(byte)0xbc,(byte)0x94,(byte)0xc9,(byte)0x94,(byte)0xd1,
(byte)0x94,(byte)0xd3,(byte)0x94,(byte)0xdb,(byte)0x94,
(byte)0xdd,(byte)0x94,(byte)0xde,(byte)0x94,(byte)0xec,
(byte)0x94,(byte)0xef,(byte)0x95,(byte)0x44,(byte)0x95,
(byte)0x5a,(byte)0x95,(byte)0x62,(byte)0x95,(byte)0x64,
(byte)0x95,(byte)0x73,(byte)0x95,(byte)0xb0,(byte)0x95,
(byte)0xb2,(byte)0x95,(byte)0xb3,(byte)0x95,(byte)0xb4,
(byte)0x95,(byte)0xc6,(byte)0x95,(byte)0xc7,(byte)0x95,
(byte)0xcd,(byte)0x95,(byte)0xd1,(byte)0x95,(byte)0xd6,
(byte)0x95,(byte)0xdb,(byte)0x95,(byte)0xdf,(byte)0x95,
(byte)0xec,(byte)0x95,(byte)0xf0,(byte)0x95,(byte)0xf6,
(byte)0x95,(byte)0xfc,(byte)0x96,(byte)0x41,(byte)0x96,
(byte)0x4d,(byte)0x96,(byte)0x5c,(byte)0x96,(byte)0x62,
(byte)0x96,(byte)0x64,(byte)0x96,(byte)0x69,(byte)0x96,
(byte)0x6b,(byte)0x96,(byte)0x75,(byte)0x96,(byte)0x78,
(byte)0x96,(byte)0x79,(byte)0x96,(byte)0xa6,(byte)0x96,
(byte)0xa8,(byte)0x96,(byte)0xb9,(byte)0x96,(byte)0xbc,
(byte)0x96,(byte)0xc8,(byte)0x96,(byte)0xd4,(byte)0x96,
(byte)0xd6,(byte)0x96,(byte)0xdf,(byte)0x96,(byte)0xe9,
(byte)0x96,(byte)0xf7,(byte)0x97,(byte)0x43,(byte)0x97,
(byte)0x45,(byte)0x97,(byte)0x46,(byte)0x97,(byte)0x5d,
(byte)0x97,(byte)0x61,(byte)0x97,(byte)0x66,(byte)0x97,
(byte)0x7c,(byte)0x97,(byte)0xae,(byte)0x97,(byte)0xb0,
(byte)0x97,(byte)0xb8,(byte)0x97,(byte)0xba,(byte)0x97,
(byte)0xc0,(byte)0x97,(byte)0xc2,(byte)0x97,(byte)0xc3,
(byte)0x97,(byte)0xc5,(byte)0x97,(byte)0xc6,(byte)0x97,
(byte)0xc9,(byte)0x97,(byte)0xcd,(byte)0x97,(byte)0xd2,
(byte)0x97,(byte)0xd7,(byte)0x97,(byte)0xda,(byte)0x97,
(byte)0xdb,(byte)0x97,(byte)0xdc,(byte)0x97,(byte)0xdd,
(byte)0x97,(byte)0xde,(byte)0x97,(byte)0xe1,(byte)0x97,
(byte)0xe7,(byte)0x97,(byte)0xfd,(byte)0x97,(byte)0xfe,
(byte)0x98,(byte)0x53,(byte)0x98,(byte)0x56,(byte)0x98,
(byte)0x72,(byte)0x98,(byte)0x79,(byte)0x98,(byte)0xa8,
(byte)0x98,(byte)0xbc,(byte)0x98,(byte)0xc3,(byte)0x98,
(byte)0xc5,(byte)0x98,(byte)0xcb,(byte)0x98,(byte)0xcc,
(byte)0x98,(byte)0xcd,(byte)0x98,(byte)0xce,(byte)0x98,
(byte)0xd0,(byte)0x98,(byte)0xd1,(byte)0x98,(byte)0xd6,
(byte)0x98,(byte)0xd9,(byte)0x98,(byte)0xdb,(byte)0x98,
(byte)0xdd,(byte)0x98,(byte)0xe4,(byte)0x98,(byte)0xe6,
(byte)0x98,(byte)0xe8,(byte)0x98,(byte)0xe9,(byte)0x98,
(byte)0xeb,(byte)0x98,(byte)0xec,(byte)0x98,(byte)0xf4,
(byte)0x98,(byte)0xfe,(byte)0x99,(byte)0x40,(byte)0x99,
(byte)0x46,(byte)0x99,(byte)0x48,(byte)0x99,(byte)0x4b,
(byte)0x99,(byte)0x4e,(byte)0x99,(byte)0x55,(byte)0x99,
(byte)0x56,(byte)0x99,(byte)0x59,(byte)0x99,(byte)0x5b,
(byte)0x99,(byte)0x67,(byte)0x99,(byte)0x6e,(byte)0x99,
(byte)0x73,(byte)0x99,(byte)0x7a,(byte)0x99,(byte)0x7b,
(byte)0x99,(byte)0xa1,(byte)0x99,(byte)0xa5,(byte)0x99,
(byte)0xa7,(byte)0x99,(byte)0xad,(byte)0x99,(byte)0xb3,
(byte)0x99,(byte)0xbc,(byte)0x99,(byte)0xc3,(byte)0x99,
(byte)0xc7,(byte)0x99,(byte)0xce,(byte)0x99,(byte)0xcf,
(byte)0x99,(byte)0xde,(byte)0x99,(byte)0xe1,(byte)0x99,
(byte)0xe9,(byte)0x99,(byte)0xf5,(byte)0x99,(byte)0xf8,
(byte)0x9a,(byte)0x48,(byte)0x9a,(byte)0x49,(byte)0x9a,
(byte)0x50,(byte)0x9a,(byte)0x55,(byte)0x9a,(byte)0x58,
(byte)0x9a,(byte)0x5a,(byte)0x9a,(byte)0x5c,(byte)0x9a,
(byte)0x60,(byte)0x9a,(byte)0x63,(byte)0x9a,(byte)0x6e,
(byte)0x9a,(byte)0x70,(byte)0x9a,(byte)0x79,(byte)0x9a,
(byte)0x7b,(byte)0x9a,(byte)0xbd,(byte)0x9a,(byte)0xec,
(byte)0x9b,(byte)0x4d,(byte)0x9b,(byte)0xa9,(byte)0x9b,
(byte)0xaa,(byte)0x9b,(byte)0xb8,(byte)0x9b,(byte)0xbe,
(byte)0x9b,(byte)0xc2,(byte)0x9b,(byte)0xdf,(byte)0x9b,
(byte)0xe3,(byte)0x9b,(byte)0xea,(byte)0x9b,(byte)0xee,
(byte)0x9c,(byte)0x4a,(byte)0x9c,(byte)0x5c,(byte)0x9c,
(byte)0x6f,(byte)0x9c,(byte)0x79,(byte)0x9c,(byte)0xa1,
(byte)0x9c,(byte)0xa5,(byte)0x9c,(byte)0xba,(byte)0x9c,
(byte)0xbb,(byte)0x9c,(byte)0xbe,(byte)0x9c,(byte)0xc6,
(byte)0x9c,(byte)0xc8,(byte)0x9c,(byte)0xd1,(byte)0x9c,
(byte)0xf8,(byte)0x9d,(byte)0x46,(byte)0x9d,(byte)0x49,
(byte)0x9d,(byte)0x4f,(byte)0x9d,(byte)0x51,(byte)0x9d,
(byte)0x5d,(byte)0x9d,(byte)0x73,(byte)0x9d,(byte)0x78,
(byte)0x9d,(byte)0x7b,(byte)0x9d,(byte)0xa5,(byte)0x9d,
(byte)0xaa,(byte)0x9d,(byte)0xad,(byte)0x9d,(byte)0xb5,
(byte)0x9d,(byte)0xcc,(byte)0x9d,(byte)0xce,(byte)0x9d,
(byte)0xee,(byte)0x9d,(byte)0xf3,(byte)0x9e,(byte)0x53,
(byte)0x9e,(byte)0x64,(byte)0x9e,(byte)0x7a,(byte)0x9e,
(byte)0x7e,(byte)0x9e,(byte)0xa4,(byte)0x9e,(byte)0xb4,
(byte)0x9e,(byte)0xb8,(byte)0x9e,(byte)0xb9,(byte)0x9e,
(byte)0xbb,(byte)0x9e,(byte)0xc5,(byte)0x9e,(byte)0xc9,
(byte)0x9e,(byte)0xcd,(byte)0x9e,(byte)0xda,(byte)0x9e,
(byte)0xdd,(byte)0x9e,(byte)0xde,(byte)0x9e,(byte)0xdf,
(byte)0x9e,(byte)0xe5,(byte)0x9e,(byte)0xe7,(byte)0x9e,
(byte)0xee,(byte)0x9e,(byte)0xf0,(byte)0x9e,(byte)0xfc,
(byte)0x9f,(byte)0x70,(byte)0x9f,(byte)0xa5,(byte)0x9f,
(byte)0xd7,(byte)0x9f,(byte)0xd9,(byte)0xa0,(byte)0x53,
(byte)0xa0,(byte)0x68,(byte)0xa0,(byte)0x6a,(byte)0xa0,
(byte)0x6f,(byte)0xa0,(byte)0x78,(byte)0xa0,(byte)0x7e,
(byte)0xa0,(byte)0xac,(byte)0xa0,(byte)0xd0,(byte)0xa0,
(byte)0xda,(byte)0xa0,(byte)0xde,(byte)0xa0,(byte)0xe6,
(byte)0xa0,(byte)0xf9,(byte)0xc6,(byte)0xcd,(byte)0xc8,
(byte)0xd6,(byte)0xc8,(byte)0xd7,(byte)0xc8,(byte)0xd8,
(byte)0xc8,(byte)0xd9,(byte)0xc8,(byte)0xda,(byte)0xc8,
(byte)0xdb,(byte)0xc8,(byte)0xdc,(byte)0xc8,(byte)0xdd,
(byte)0xc8,(byte)0xde,(byte)0xc8,(byte)0xdf,(byte)0xc8,
(byte)0xe0,(byte)0xc8,(byte)0xe1,(byte)0xc8,(byte)0xe2,
(byte)0xc8,(byte)0xe3,(byte)0xc8,(byte)0xe4,(byte)0xc8,
(byte)0xe5,(byte)0xc8,(byte)0xe6,(byte)0xc8,(byte)0xe7,
(byte)0xc8,(byte)0xe8,(byte)0xc8,(byte)0xe9,(byte)0xc8,
(byte)0xea,(byte)0xc8,(byte)0xeb,(byte)0xc8,(byte)0xec,
(byte)0xc8,(byte)0xed,(byte)0xc8,(byte)0xee,(byte)0xc8,
(byte)0xef,(byte)0xc8,(byte)0xf0,(byte)0xc8,(byte)0xf1,
(byte)0xfa,(byte)0x45,(byte)0xfa,(byte)0x48,(byte)0xfa,
(byte)0x68,(byte)0xfa,(byte)0x6b,(byte)0xfa,(byte)0xa5,
(byte)0xfa,(byte)0xcc,(byte)0xfa,(byte)0xcd,(byte)0xfa,
(byte)0xd0,(byte)0xfa,(byte)0xe0,(byte)0xfa,(byte)0xe8,
(byte)0xfa,(byte)0xfa,(byte)0xfa,(byte)0xfd,(byte)0xfb,
(byte)0x43,(byte)0xfb,(byte)0x4b,(byte)0xfb,(byte)0x5e,
(byte)0xfb,(byte)0x65,(byte)0xfb,(byte)0x70,(byte)0xfb,
(byte)0x7a,(byte)0xfb,(byte)0x7d,(byte)0xfb,(byte)0xb6,
(byte)0xfb,(byte)0xb9,(byte)0xfb,(byte)0xbf,(byte)0xfb,
(byte)0xc1,(byte)0xfb,(byte)0xc9,(byte)0xfb,(byte)0xca,
(byte)0xfb,(byte)0xd3,(byte)0xfb,(byte)0xdc,(byte)0xfb,
(byte)0xea,(byte)0xfb,(byte)0xef,(byte)0xfb,(byte)0xf0,
(byte)0xfc,(byte)0x42,(byte)0xfc,(byte)0x49,(byte)0xfc,
(byte)0x4a,(byte)0xfc,(byte)0x59,(byte)0xfc,(byte)0x64,
(byte)0xfc,(byte)0x65,(byte)0xfc,(byte)0x66,(byte)0xfc,
(byte)0x6a,(byte)0xfc,(byte)0xa6,(byte)0xfc,(byte)0xb4,
(byte)0xfc,(byte)0xc2,(byte)0xfc,(byte)0xc4,(byte)0xfc,
(byte)0xcf,(byte)0xfc,(byte)0xd1,(byte)0xfc,(byte)0xee,
(byte)0xfc,(byte)0xf7,(byte)0xfd,(byte)0x49,(byte)0xfd,
(byte)0x4a,(byte)0xfd,(byte)0x4c,(byte)0xfd,(byte)0x50,
(byte)0xfd,(byte)0x53,(byte)0xfd,(byte)0x5d,(byte)0xfd,
(byte)0x61,(byte)0xfd,(byte)0x6c,(byte)0xfd,(byte)0x7a,
(byte)0xfd,(byte)0xa2,(byte)0xfd,(byte)0xa3,(byte)0xfd,
(byte)0xc4,(byte)0xfd,(byte)0xca,(byte)0xfd,(byte)0xce,
(byte)0xfd,(byte)0xd1,(byte)0xfd,(byte)0xe8,(byte)0xfd,
(byte)0xe9,(byte)0xfe,(byte)0x4d,(byte)0xfe,(byte)0x56,
(byte)0xfe,(byte)0x64,(byte)0xfe,(byte)0x6e,(byte)0xfe,
(byte)0x78,(byte)0xfe,(byte)0x7d,(byte)0xfe,(byte)0xb6,
(byte)0xfe,(byte)0xc5,(byte)0xfe,(byte)0xfb };
public static void main(String[] args) throws Exception {
byte[] encodedBytes = new byte[1000];
encodedBytes = uni21String.getBytes("Big5-HKSCS");
for (int i = 0; i < encodedBytes.length - 1; i++) {
if (encodedBytes[i] != expectedBytes[i]
|| encodedBytes[i+1] != expectedBytes[i+1]) {
throw new Exception("Unexpected char->byte HKSCS mappings");
}
}
}
}

View File

@ -0,0 +1,54 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
* @bug 4195325
* @summary name() should return "X11JIS0201"
*
*/
import java.nio.charset.*;
public class TestX11JIS0201 {
public static void main(String args[])
throws Exception
{
test();
}
private static void test()
throws Exception
{
Class cl = null;
try {
cl = Class.forName("sun.awt.motif.X11JIS0201");
} catch (Exception e){
return;
}
Charset cs = (Charset)cl.newInstance();
if (! cs.name().equals("X11JIS0201")){
throw new Exception("X11JIS0201 does not work correctly");
}
}
}

View File

@ -0,0 +1,76 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
@bug 4890726
@summary Check the correctness of KOI8_U by comparing to KOI8_R
*/
import java.util.*;
import static java.lang.Character.UnicodeBlock;
public class UkrainianIsNotRussian {
private static String decode(byte[] bytes, String encoding) throws Throwable {
String s = new String(bytes, encoding);
equal(s.length(), 1);
check(Arrays.equals(s.getBytes(encoding), bytes));
return s;
}
private static void realMain(String[] args) throws Throwable {
final byte[] bytes = new byte[1];
int differences = 0;
for (int i = 0; i < 0xff; i++) {
bytes[0] = (byte) i;
final String r = decode(bytes, "KOI8_R");
final String u = decode(bytes, "KOI8_U");
if (! r.equals(u)) {
differences++;
final char rc = r.charAt(0);
final char uc = u.charAt(0);
final UnicodeBlock rcb = UnicodeBlock.of(rc);
final UnicodeBlock ucb = UnicodeBlock.of(uc);
System.out.printf("%02x => %04x %s, %04x %s%n",
i, (int) rc, rcb, (int) uc, ucb);
check(rcb == UnicodeBlock.BOX_DRAWING &&
ucb == UnicodeBlock.CYRILLIC);
}
}
equal(differences, 8);
}
//--------------------- Infrastructure ---------------------------
static volatile int passed = 0, failed = 0;
static void pass() {passed++;}
static void fail() {failed++; Thread.dumpStack();}
static void fail(String msg) {System.out.println(msg); fail();}
static void unexpected(Throwable t) {failed++; t.printStackTrace();}
static void check(boolean cond) {if (cond) pass(); else fail();}
static void equal(Object x, Object y) {
if (x == null ? y == null : x.equals(y)) pass();
else fail(x + " not equal to " + y);}
public static void main(String[] args) throws Throwable {
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
}

View File

@ -0,0 +1,52 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
* @bug 4522270
@summary Ensure that a zeroed byte array produces a valid String when EUC-TW decoded
*/
public class ZeroedByteArrayEUCTWTest
{
public static void main(String[] args) throws Exception {
test("cns11643");
}
public static void test(String encoding) throws Exception {
String result = null;
byte[] data = new byte[16];
for (int i = 0; i < 16; i++) {
data[i] = 0;
}
result = new String(data, encoding);
if (result.length() != 16)
throw new Exception ("EUC_TW regression test bugID 4522270 failed");
for (int i=0; i < 16; i++) {
data[i] = (byte)( 32 + i);
}
}
}