Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6954992

how to handle tilde char. in jdk6 should be backport to jdk5

XMLWordPrintable

    • b04
    • x86
    • windows_vista
    • Verified

        Our CU's customer faces with the difference behavior between jdk6 and jdk5,
        when their program tries to output a XML object including tilde(multibyte, \uFF5E) char.
        to xml file in Shift-JIS.

        REPRODUCE:
        1. Compile the attached d.java
        2. Invoke "java -showversion d"
        3. Invoke "type a.xml"

        The results are as followis.

        C:\Users\licensees\tilde>java -showversion d
        java version "1.5.0_20"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_20-b02)
        Java HotSpot(TM) Client VM (build 1.5.0_20-b02, mixed mode)


        C:\Users\licensees\tilde>type a.xml
        <?xml version="1.0" encoding="Shift_JIS"?><root><data>?</data></root>
        C:\Users\tbaba\licensees\childer>set path=C:\Users\tbaba\java\jdk6_18\bin;%path%


        C:\Users\licensees\tilde>java -showversion d
        java version "1.6.0_18"
        Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
        Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode)


        C:\Users\licensees\tilde>type a.xml
        <?xml version="1.0" encoding="Shift_JIS" standalone="no"?><root><data>&#65374;</
        data></root>

        The above result says,

        JDK5 : tilde is output as "?"
        JDK6 : tilde is outpu &#65374 (escaped)

        The way of handling tilde in jdk6 should be backport to jdk5.

        INVESTIGATION:
        SUN_CHAR2BYTE_CONVERTER_METHOD to which getCharToByteConverter(String encoding) in Encodings.java refers is always null in jdk5. This seems to cause thsi problem in jdk5.

        NOTE:
        Suggested fix is provided for jdk5u24. Please see attached "Encodings.java".

              asaha Abhijit Saha
              tbaba Tadayuki Baba (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: