2004年2月9日 星期一

Tomcat 4.1.29

不論怎麼在靜態的HTML文件當中設定Charset,新版的tomcat就是不理會
總是輸出charset=ISO8859-1給Browser,目前解法有二:

1. 設定Apache的預設編碼(not a good idea)
AddDefaultCharset big5
2. patch tomcat source

For a real fix, you can apply a patch to the Tomcat code:

Index: Response.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- Response.java 14 Oct 2003 19:21:25 -0000 1.29
+++ Response.java 11 Nov 2003 20:56:56 -0000 1.30
@@ -552,9 +552,11 @@

String ret = contentType;

- if (ret != null && characterEncoding != null) {
- ret += ";charset=";
- ret += characterEncoding;
+ if (ret != null
+ && characterEncoding != null
+ && !(Constants.DEFAULT_CHARACTER_ENCODING.equals
+ (characterEncoding))) {
+ ret = ret + ";charset=" + characterEncoding;
}

return ret;

3. 先改用4.1.27吧

http://marc.theaimsgroup.com/?l=tomcat-user&m=106916700914797&w=2
http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg110266.html

沒有留言: