cookie中不能包含的特殊字符

昨天有客户投诉,说其购买的关键字: 钻石珠宝,diy    不能正常看到对应的广告位,查了下网站对应的广告投放记录是正常的。
   
    最后确认是,searchweb在记录对应的用户最近搜索关键字cookie时,因为特殊字符违反了cookie的规范,导致最近搜索记录里没有用户上一 次搜索钻石珠宝,diy的记录。
   
对应javaapi中cookie规范描述:
Constructs a cookie with a specified name and value.

The name must conform to RFC 2109. That means it can contain only ASCII alphanumeric characters and cannot contain commas, semicolons, or white space or begin with a $ character. The cookie's name cannot be changed after creation.

The value can be anything the server chooses to send. Its value is probably of interest only to the server. The cookie's value can be changed after creation with the setValue method.

By default, cookies are created according to the Netscape cookie specification. The version can be changed with the setVersion method.


在firefox , ie , google chrome下测试验证了下, 发现对于 逗号(,) , 空格, 分号(;) ,$打头的字符 。cookie都无法正常写入, 需要实现进行编码encode处理。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值