8039474: sun.misc.CharacterDecoder.decodeBuffer should use getBytes(iso8859-1)
Summary: Specify ISO-8859-1 as charset of String to decode.
Reviewed-by: chegar, sherman, mduigou, mchung
--- a/jdk/src/share/classes/sun/misc/CharacterDecoder.java Thu Apr 10 20:01:52 2014 +0100
+++ b/jdk/src/share/classes/sun/misc/CharacterDecoder.java Thu Apr 10 13:19:29 2014 -0700
@@ -184,7 +184,7 @@
* @exception CEFormatException An error has occurred while decoding
*/
public byte[] decodeBuffer(String inputString) throws IOException {
- byte inputBuffer[] = inputString.getBytes();
+ byte inputBuffer[] = inputString.getBytes("ISO-8859-1");
ByteArrayInputStream inStream = new ByteArrayInputStream(inputBuffer);
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
decodeBuffer(inStream, outStream);
--- a/jdk/src/share/classes/sun/misc/CharacterEncoder.java Thu Apr 10 20:01:52 2014 +0100
+++ b/jdk/src/share/classes/sun/misc/CharacterEncoder.java Thu Apr 10 13:19:29 2014 -0700
@@ -190,7 +190,7 @@
try {
encode(inStream, outStream);
// explicit ascii->unicode conversion
- retVal = outStream.toString("8859_1");
+ retVal = outStream.toString("ISO-8859-1");
} catch (Exception IOException) {
// This should never happen.
throw new Error("CharacterEncoder.encode internal error");