You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Geo Lam <ge...@hotmail.com> on 2002/08/07 06:19:29 UTC
UTF-8 encoding problem (responding to browser)
Dear all,
I have search the arhive list concerning the encoding problem of reading
double byte character. I have used the tomcat filter to successfully reading
chinese UTF-8 character and saving it into database(MS SQLServer2000 -MS
JDBC driver).
However, in the same servlet, I used the output writer to write the same
string to the browser only with "???" characters. I have set
response.setContentType("text/html;charset=UTF-8") but it doesn't work.
What can I do to correct the output problem? Thanks.
Attached: a segment of code;
// using tomcat filter to perform request.setCharacterEncoding("UTF-8")
System.out.println(request.getParameter("edTextBox"));
// output is ?? in browser but database is correct (display using
System.out.print is also correct)
System.out.println("response-encoding: " + response.getCharacterEncoding()
);
//output indicates that response is in UTF-8
Thanks
_________________________________________________________________
Join the worlds largest e-mail service with MSN Hotmail.
http://www.hotmail.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: UTF-8 encoding problem (responding to browser)
Posted by Tony LaPaso <tl...@attbi.com>.
I've been doing something similar lately with no problem -- my
text is being displayed in Chinese just fine. I am also using
UTF-8 with content-type=text/html;charset=utf-8.
There are two things I would look at:
1. Can your browser display whatever language you are trying to
display? If you do not have the correct font you will see ????.
2. Are you sending a META tag that might be overriding the
content-type header?
3. Also, if you have a sniffer, I would recommend looking at the
incoming/outgoing byte stream.
----- Original Message -----
From: "Geo Lam" <ge...@hotmail.com>
To: <to...@jakarta.apache.org>
Sent: Tuesday, August 06, 2002 11:19 PM
Subject: UTF-8 encoding problem (responding to browser)
> Dear all,
> I have search the arhive list concerning the encoding problem
of reading
> double byte character. I have used the tomcat filter to
successfully reading
> chinese UTF-8 character and saving it into database(MS
SQLServer2000 -MS
> JDBC driver).
> However, in the same servlet, I used the output writer to
write the same
> string to the browser only with "???" characters. I have set
> response.setContentType("text/html;charset=UTF-8") but it
doesn't work.
> What can I do to correct the output problem? Thanks.
>
> Attached: a segment of code;
> // using tomcat filter to perform
request.setCharacterEncoding("UTF-8")
> System.out.println(request.getParameter("edTextBox"));
>
> // output is ?? in browser but database is correct (display
using
> System.out.print is also correct)
>
> System.out.println("response-encoding: " +
response.getCharacterEncoding()
> );
> //output indicates that response is in UTF-8
>
> Thanks
>
>
>
>
_________________________________________________________________
> Join the worlds largest e-mail service with MSN Hotmail.
> http://www.hotmail.com
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>