Bug 23125

Summary: Error of fmt set charset of ContentType in webpage
Product: Taglibs Reporter: haibin zhang <dragzhb>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED DUPLICATE    
Severity: normal CC: adam.hardy
Priority: P3    
Version: 1.0.2   
Target Milestone: ---   
Hardware: All   
OS: Linux   

Description haibin zhang 2003-09-12 06:51:03 UTC
I havd found fmt has set charset of ContentType in webpage, this is very error.

example ,I must use webpage charset as utf-8. I use:
<%@ page contentType="text/html;charset=UTF-8"%> in jsp page 

but I see head of page ,it has set my charset to client browser charset GB2312.
This is the result:
 wget -S http://10.220.8.195:8080/hnpostwap/testi18n.jsp
--14:37:05--  http://10.220.8.195:8080/hnpostwap/testi18n.jsp
           => `testi18n.jsp.1'
Connecting to 10.220.8.195:8080... connected.
HTTP request sent, awaiting response...
 1 HTTP/1.1 200 OK
 2 Set-Cookie: JSESSIONID=B888CF338DD7E0A356A8E38963537305; Path=/hnpostwap
 3 Content-Type: text/html;charset=GB2312
 4 Content-Language: zh-CN
 5 Content-Length: 163
 6 Date: Fri, 12 Sep 2003 06:37:06 GMT
 7 Server: Apache Coyote/1.0
 8 Connection: Keep-Alive

When I use jakarta structs 's i18n ,it don't set charset in my web page, use my
charset utf-8 what I set in web page.

This is result:
wget -S http://10.220.8.195:8080/hnpostwap/testi18n.jsp
--14:24:54--  http://10.220.8.195:8080/hnpostwap/testi18n.jsp
           => `testi18n.jsp'
Connecting to 10.220.8.195:8080... connected.
HTTP request sent, awaiting response...
 1 HTTP/1.1 200 OK
 2 Set-Cookie: JSESSIONID=CD86B15EEA87F4B55DF02B4829FD1F61; Path=/hnpostwap
 3 Content-Type: text/html;charset=UTF-8
 4 Content-Length: 153
 5 Date: Fri, 12 Sep 2003 06:24:55 GMT
 6 Server: Apache Coyote/1.0
 7 Connection: Keep-Alive


The following is fmt source code:
<%@ page contentType="text/html;charset=UTF-8"%>

<%@ page import = "java.util.* "%>
<%@ page import  = "java.io.*,java.sql.*,javax.sql.*,javax.naming.*"%>
<%@ page import = "org.apache.log4j.Logger"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>

<html>
<head>
<title><fmt:message key="logo.title"/></title>

</head>
<body bgcolor="white">


<fmt:message key="logo.title"/>

</body>
</html>


the following is structs source code:
<%@ page contentType="text/html;charset=UTF-8"%>

<%@ page import = "java.util.* "%>
<%@ page import  = "java.io.*,java.sql.*,javax.sql.*,javax.naming.*"%>
<%@ page import = "org.apache.log4j.Logger"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<html>
<head>
<title><bean:message key="stock.title"/></title>

</head>
<body bgcolor="white">

<bean:message key="stock.title"/>

</body>
</html>
Comment 1 Pierre Delisle 2003-12-12 00:36:41 UTC
Haibin,

Please see bug #19408 for explanations, and run your webapp using Tomcat 5 and
JSTL 1.1. Everything should then work fine.

*** This bug has been marked as a duplicate of 19408 ***