美文网首页
Cookie报错: An invalid character [

Cookie报错: An invalid character [

作者: 面糊 | 来源:发表于2019-08-19 23:15 被阅读0次
1. 格式化输出日期时报错: `yyyy年MM月dd日 HH:mm:ss`
2. Tomecat8之后, 虽然支持中文输出, 但是对于一些特殊字符还是不支持, `[32]`表示空格
3. 解决:
    1. 在输出之前, 使用`URLEncoder`进行编码 
        + `dateString = URLEncoder.encode(dateString, "utf-8");`
    2. 对于编码的数据, 如果要从浏览器中获取到服务端, 要对其进行解码
        + `String dateString = URLDecoder.decode(cookie.getValue(), "utf-8");`

相关文章

网友评论

      本文标题:Cookie报错: An invalid character [

      本文链接:https://www.haomeiwen.com/subject/cupysctx.html