原文:tomcat7中cookie写入中文引发Control character in cookie value or attribute异常

public static void CreateCookie String username,HttpServletRequest req,HttpServletResponse resp,int sec throws Exception String encode URLEncoder.encode username, UTF Cookie usercookie new Cookie use ...

2019-07-05 20:17 4 2416 推荐指数:

查看详情

Control character in cookie value or attribute

貌似是Tomcat7中文支持不那么好了,两个步骤即可解决,以name举例 设置Cookie时,name=URLEncoder.encode(name,"UTF-8"); 读取Cookie时,name=URLDecoder.decode(name,"UTF-8"); ...

Thu Nov 01 05:10:00 CST 2012 1 10096
Tomcat报错Control character in cookie value or attribute.

Tomcat若出现如下错误:java.lang.IllegalArgumentException: Control character in cookie value or attribute.如下图所示: 产生该问题原因:Cookie处理中文时编码问题,中文采用的是Unicode编码 ...

Tue Nov 08 04:11:00 CST 2016 0 26692
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM