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)
======================================================================
- duplicates
-
JDK-4378278 java.io.PrintStream(..., String encoding) constructor
-
- Resolved
-