public void setHeader(java.lang.String name, java.lang.String value)Sets a response header with the given name and value. If the header had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value. Parameters: name - the name of the header (注意下面) value - the header value If it contains octet string, it should be encoded according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt)你可以去查查RFC 2047 ,我英语不好,看起来痛苦建议使用url编码response.setHeader("Content-Disposition",java.net.URLEncoder.encode("中文字符串","GB2312")); 在客户端解码java.net.URLDecoder.decode(...);
java.lang.String value)Sets a response header with the given name and value. If the header had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.
Parameters:
name - the name of the header
(注意下面)
value - the header value If it contains octet string, it should be encoded according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt)你可以去查查RFC 2047 ,我英语不好,看起来痛苦建议使用url编码response.setHeader("Content-Disposition",java.net.URLEncoder.encode("中文字符串","GB2312"));
在客户端解码java.net.URLDecoder.decode(...);
应该是对的,我以前在.net上也是url编码的问题,需要urlencoder
客户端还要转码吗?交给IE做就可以了吧?
struts里就好办多了:
java.net.URLEncoder.encode("中文字符串","UTF-8")
就OK了