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

Manifest file can not include UTF-8 string correctly.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 6
    • tools
    • jar
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      mustang
      build 1.6.0-rc-b94

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP SP2

      A DESCRIPTION OF THE PROBLEM :
      In the manifest specification,
      - Each line in manifest file must be UTF-8 encoding.
      - Each line in manifest file must be under 72 bytes.

      But it seems that java.util.jar.Manifest class could not treat lines as UTF-8.

      I found this problem while I use jarsigner.
      I tried to sign a jar file including UTF-8 filenames.(non-ascii)

      Manifest class seems to have 2 problems.

      - It cut each line by String.length not by byte length.
         >> should cut by bytes length.
      - It uses DataOutputStream.writeBytes(String) which is not appreciate treat UTF-8 correctly.(high-bits dropped)
         >> should use String.getBytes() method

      I checked this problem on
      - JDK 1.5.0_07
      - JDK 1.6.0 b94


      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Don't use UTF-8 character in Manifest file.

            Unassigned Unassigned
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: