/**
*******************************************************************************
- * Copyright (C) 2006-2011, International Business Machines Corporation and *
+ * Copyright (C) 2006-2012, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
/* fix maxBytesPerUChar depending on outputType and options etc. */
if (outputType == MBCS_OUTPUT_2_SISO) {
- maxBytesPerChar = 3; /* SO+DBCS */
+ /* changed from 3 to 4 in ICU4J only. #9205 */
+ maxBytesPerChar = 4; /* SO+DBCS+SI*/
}
extIndexes = mbcsTable.extIndexes;
/**
*******************************************************************************
-* Copyright (C) 2006-2011, International Business Machines Corporation and *
+* Copyright (C) 2006-2012, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
int[] expected = {
40,
20,
- 60,
+ 80, /* changed from 60 to 80 to reflect the updates by #9205 */
80,
60
};
}
}
}
+
+ /*
+ * When converting with the String method getBytes(), buffer overflow exception is thrown because
+ * of the way ICU4J is calculating the max bytes per char. This should be changed only on the ICU4J
+ * side to match what the Java method is expecting. The ICU4C size will be left unchanged.
+ * Ticket #9205
+ */
+ public void TestBufferOverflowErrorUsingJavagetBytes() {
+ String charsetName = "ibm-5035";
+ String testCase = "\u7d42";
+
+ try {
+ testCase.getBytes(charsetName);
+ } catch (Exception ex) {
+ errln("Error calling getBytes(): " + ex);
+ }
+
+ }
}