permaculture playing cards*
The moose likes JSP and the fly likes Problem in setting character encoding in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Problem in setting character encoding in JSP" Watch "Problem in setting character encoding in JSP" New topic
Author

Problem in setting character encoding in JSP

Mina Syal
Ranch Hand

Joined: Jun 24, 2004
Posts: 31
Hello,

I am setting up character encoding in JSP dynamically using following meta tag:

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=<%=charset%>"

if charset value comes Big5 then it become
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Big5">

but browser is always showing contents in ASCII and not the encoding set by my JSP.
When I manually select View-->Encoding-->Chinese Traditional (Big5) in my Internet Explorer, it works.

Please help.

Thanks in advance,
Mina.
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
maybe this will help

<%@ page
language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
%>


SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Mina Syal
Ranch Hand

Joined: Jun 24, 2004
Posts: 31
I added following line in my jsp:

response.setContentType("text/html;charset"+scharset);


and now its working fine.


Thanks.
 
GeeCON Prague 2014
 
subject: Problem in setting character encoding in JSP