昨天有客户投诉,说其购买的关键字: 钻石珠宝,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处理。