8039474: sun.misc.CharacterDecoder.decodeBuffer should use getBytes(iso8859-1)
authorbpb
Thu, 10 Apr 2014 13:19:29 -0700
changeset 23742 c2b6216ef41d
parent 23741 03987fb914a9
child 23743 92cae64be74e
child 23930 0e5983df5018
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
jdk/src/share/classes/sun/misc/CharacterDecoder.java
jdk/src/share/classes/sun/misc/CharacterEncoder.java
--- 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");