Response encoding problem 2006-11-18 - By ruphus13
Back Hi - I'm trying to show utf-8 (See http://utf-8.ora-code.com) data in the browser from my jsp page. When the page renders, its character encoding is iso-8859 (See http://iso-8859.ora-code.com)-1, according to the browser. The http response headers have the same encoding (iso-8859 (See http://iso-8859.ora-code.com)-1).
Here's what's been done thus far:
1) meta tag set as follows: <meta http-equiv="Content-Type" content="text/html; charset=utf-8 (See http://utf-8.ora-code.com)"/>
2) jsp page encoding directive issued at the start of the jsp page. <%@(protected) contentType="text/html; charset=UTF-8 (See http://UTF-8.ora-code.com)"%>
3) Generated jsp page has the following java code, as a consequence: try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType("text/html; charset=UTF-8 (See http://UTF-8.ora-code.com)"); pageContext = _jspxFactory.getPageContext(this, request, response, null, false, 8192, true); application = pageContext.getServletContext(); config = pageContext.getServletConfig(); out = pageContext.getOut(); _jspx_out = out; ... 4) When I save the page as an html file and open it as an html file in the browser, it renders correctly (due to the meta tag and no http headers), which is expected.
5) Manually changing the page encoding in firefox results in the page being rendered correctly.
6) Also set utf-8 (See http://utf-8.ora-code.com) in the connector settings in tomcat/conf/server.xml (for GETs?)
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector " port="8080" minProcessors="5" maxProcessors="75" URIEncoding="UTF-8 (See http://UTF-8.ora-code.com)" useBodyEncodingForURI="true" enableLookups="true" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" useURIValidationHack="false" disableUploadTimeout="true" />
7) Set utf-8 (See http://utf-8.ora-code.com) in web.xml as follows: <servlet> <servlet-name>jsp</servlet-name> <servlet-class>org.apache.jasper.servlet.JspServlet </servlet-class> <init-param> <param-name>javaEncoding</param-name> <param-value>UTF8</param-value> </init-param> ...
However, the page still shows up as iso-8859 (See http://iso-8859.ora-code.com)-1 (in firefox and IE), and viewing the response headers using a 3rd party plugin shows the content-type as ISO-8859 (See http://ISO-8859.ora-code.com)-1
Tomcat: 4.1.31 JDK: 1.4.2
What I'm hoping to learn is how to set the http response headers correctly. It seems that the generated java code is doing the right thing. However, the response header is still jacked...
Any help will be very, very much appreciated! I've gone through several articles on Goog as well as the tomcat mailing list... The brick wall is getting bloodier, and I'm getting woozy from the pounding...
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To start a new topic, e-mail: users@(protected) To unsubscribe, e-mail: users-unsubscribe@(protected) For additional commands, e-mail: users-help@(protected)
|
|