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

Provide encoding in constructor of Printwriter

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.0
    • core-libs
    • generic
    • generic



      Name: krT82822 Date: 10/26/99


      The PrintWriter class which is used especially in servlets
      uses the default encoding for transforming characters to
      bytes and send them to the browser. This may be ok in the Latin
      character speaking and serving(where the webserver resides) world
      but everywhere else it would be great to have a constructor
      where you can specify the encoding to use for encoding
      characters.

      A code sample for this is provided in the work around section.

      I just use the MyPrintWriter class instead of simple PrintWriter.

      In my case I have servlets which take multilanguage data from a
      database and construct html pages. Let's suppose the servlet reads
      the data correctly from the database (this is a story for it's own-
      even when the database stores unicode data it is not straightforward)

      According to the users language, I have to transform the java unicode
      characters to bytes using the correct encoding. With the proposed
      addition this is done automatically
      (Review ID: 96834)
      ======================================================================

            ilittlesunw Ian Little (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: