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

JDK does not support charset HZ-GB-2312

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.4.2
    • core-libs

      Name: gm110360 Date: 02/25/2004


      FULL PRODUCT VERSION :
      java version "1.4.2_03"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
      Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)


      A DESCRIPTION OF THE PROBLEM :
      The JDK (and therefore by extension JavaMail) does not seem to support any mail encoded with an HZ-GB-2312 encoding. The Macintosh Mail.App 5 produces mail with this encoding when sending Chinese characters. HZ-GB-2312 is defined by RFC 1842, which has existed since 1995, so it seems as though Java should support it natively.

      I submitted this report to the JavaMail group and was told to resubmit to the JDK group.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a mail whose MIME parts are encoded in the HZ-GB-2312 charset. 2. Create a javax.mail.internet.MimeMessage object with its input stream containing the mail from step 1. 3. Call getContent() on the object from step 2, to get a MimeMultipart. 4. Call getContent() on the MimeMultipart object.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I should get the contents of the mail as a Unicode Java String.
      ACTUAL -
      An UnsupportedEncodingException is thrown.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Here is an example mail that causes the problem:

      Return-Path: <###@###.###>
      Received: from mallenovid.pgp.com (account mike [63.251.255.247] verified)
        by pgpqafullsail.com (CommuniGate Pro SMTP 4.0.6)
        with ESMTP-TLS id 1360085 for ###@###.###; Tue, 30 Dec 2003 18:05:28 -0800
      Received: from [63.251.255.44] ([63.251.255.44])
        by mallenovid.pgp.com (PGP Universal service);
        Tue, 30 Dec 2003 17:45:35 -0800
      X-PGP-Universal: processed
      Mime-Version: 1.0 (Apple Message framework v609)
        To: ###@###.###
      Message-Id: <###@###.###>
        From: Michael Allen <###@###.###>
        Subject: Test Chinese characters mail
      Date: Tue, 30 Dec 2003 17:45:35 -0800
      X-Mailer: Apple Mail (2.609)
      Content-Type: multipart/mixed;
      boundary="PGP_Universal_1B38385F_2386C159_6A94AE50_84FAD77D"




      --PGP_Universal_1B38385F_2386C159_6A94AE50_84FAD77D
      Content-Type: multipart/alternative; boundary=Apple-Mail-1-38654809


      --Apple-Mail-1-38654809
      Content-Transfer-Encoding: 7bit
      Content-Type: text/plain;
      format=flowed;
      charset=HZ-GB-2312

      ~{9)~}A/V ~{Si@V~}
      --Apple-Mail-1-38654809
      Content-Transfer-Encoding: 7bit
      Content-Type: text/enriched;
      charset=HZ-GB-2312

      <fontfamily><param>Hiragino Kaku Gothic Pro</param><x-tad-bigger>~{9)~}</x-tad-bigger></fontfamily><fontfamily><param>Arial</param><x-tad-bigger>A/V
      </x-tad-bigger></fontfamily><fontfamily><param>STHeiti</param><x-tad-bigger>~{Si@V~}</x-tad-bigger></fontfamily><fontfamily><param>Arial</param><bigger><bigger> </bigger></bigger></fontfamily>
      --Apple-Mail-1-38654809--


      --PGP_Universal_1B38385F_2386C159_6A94AE50_84FAD77D
      Content-Type: text/plain;
      name="PGP Decode Status.txt";
      charset="utf-8"
      Content-Transfer-Encoding: quoted-printable
      Content-Disposition: inline



      =2A=20PGP=20Signed:=2012/30/2003=20at=2005:45PM,=20Decrypted
      =2A=20=20=20=20=20=20=20Main=20Message=20Body
      =2A=20sunil=40=22foo=22=20=3Cmike=40pgpqafullsail.com=3E
      =2A=200x291F1067



      --PGP_Universal_1B38385F_2386C159_6A94AE50_84FAD77D--


      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Catch the Unsupported Encoding exception and then display an error to the user.
      (Incident Review ID: 234445)
      ======================================================================

            sherman Xueming Shen
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: