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

javadoc tool: -encoding option is ignored for reading package.html

XMLWordPrintable

    • beta2
    • generic
    • generic



      Name: bsC130419 Date: 05/25/2001


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
      Java HotSpot(TM) Client VM (build 1.3.0, mixed mode)


      When -encoding option is specified to javadoc, Java source codes are converted
      correctly, but package.html aren't.

      For example, an open-source project manage java source codes and related
      documents includes "package.html" in Shift-JIS and share them from various
      environments (e.g. Japanese Solaris which character encoding is Japanese-EUC).
      On solaris, package.html is converted to '???' sequences.

      This is a simple javadoc's bug.

      j2sdk1_3_0-src-sol/src/share/classes/com/sun/tools/javadoc/DocImpl.java has the
      following method which reads "package.html":

          String readHTMLDocumentation(java.io.InputStream input, String filename)
      throws java.io.IOException {
              int filesize = input.available();
              byte[] filecontents = new byte[filesize];
              input.read(filecontents, 0, filesize);
              input.close();
              String rawDoc = new String(filecontents);

      In fact, "new String(filecontents)" is the same as "new String(filecontents,
      ..., ..., ByteToCharConverter.getDefault())". Therefore, package.html always is
      converted from platform's native character encoding, not character encoding
      specified by -encoding option.

        To fix this bug, add an encoding argument to it like "new String(filecontents,
      encoding)"; it is saved in an Env object and acquired by getCharacterEncoding().
      (Review ID: 124196)
      ======================================================================

            jhosunw Jamie Ho (Inactive)
            bstrathesunw Bill Strathearn (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: