SUBSCRIBE SERVLET-INTEREST jack-wang wrote:
>
>   I try to produce Chinese_Character(CC,for short) HTML page with servlet,
> some Chinese character string is directly denoted with a string in the java
> code, and the other is selected from database. I test two servlet server
> "JRUN" and "JavaWebServer" with different cases, the result is not as good
> as I wish, which is listed below:
>
> (1)
> The Server |   output          | CC(not from Database) | CC(from Database)
> ----------------------------------------------------------------------------
> JRUN       | new PrintStream() |         OK            |         OK
> JRUN       | getOutPutStream() |      (not use CC)     |        OK
> JRUN       | getOutPutStream() | (when use CC, "500 Internal Server Error"  )
> JWS        | new PrintStream() |         OK            |       not OK
> JWS        | getOutPutStream() |       not OK          |        OK
> [...]

Try using a PrintWriter instead of an OutputStream, i.e. use getWriter instead
of getOutpuStream. If you set the charset with setContentType as described in
the spec, getWriter returns a PrintWriter with the right encoding.

The OutputStream should only be used for non-text output, such as the bytes
for an image.

--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to