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

java.io.PrintStream(..., String encoding) constructor

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.3.0
    • core-libs
    • None
    • beta
    • generic, unknown
    • generic

      java.io.PrintStream is normally used for printing out data that is
      intended to be human readable. For this reason, it uses the platform
      default encoding when converting characters to bytes.

      However, PrintStream has also been used for outputing protocol data
      such as HTTP headers. Some of the URLStreamHandlers in java.net
      actually return a PrintStream to the application so the application
      can send its own data on to the stream.

      This causes a problem, in that all internet protocols must transmit
      their data in a specific encoding (ASCII) rather than the default
      encoding supported by the platform. This problem is only apparent
      when the default encoding is set to some derivative of EBCDIC
      (such as Cp037), because EBCDIC maps the normal alpha-numeric
      characters to different values from ASCII.

      The desired solution is to add a constructor to java.io.PrintStream
      where the encoding can be specified by the caller. Protocol code
      that wants to guarantee a specific encoding such as ISO8859_1 will
      use this new constructor.

      -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

            mr Mark Reinhold
            michaelm Michael McMahon
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: