今天存储cookie用户名称时发生异常
错误信息表现:java.lang.IllegalArgumentException: RFC6265 Cookie values characters restricted to US-ASCII: 0x5f90
Cookie默认支持的编码方式是ASCII码
治疗手段:
1.创建cookieCookie cookie = new Cookie(name,URLEncoder.encode(value, "UTF-8"));
2.读取cookie
String value = URLDecoder.decode(cookie.getValue(), "UTF-8");