侧边栏Google搜索工具的乱码问题得到解决
本站右侧侧边栏的搜索工具是使用google的,可是把边框大小、颜色都设置好之后放上去,感觉挺好的。
偶尔用搜索栏搜索本站上的文章,看看效果怎么样,谁知道竟然在弹出新窗口的结果页上出现了乱码,文章是一篇都没有。输入数字搜索没有任何乱码。
于是想到月光博客上也使用了google的搜索工具,用他那个搜索一下没有出现乱码,结果也很正常。查看其源码找到搜索工具那一块,和我的代码一比较,发现我错在哪里了。
我网站使用的是"UTF-8"编码,而google的代码中我竟然选用了"GB2312"编码,竟然犯了这种错误。好些天了,总算改过来了。
附原来代码:
<input type="hidden" name="ie" value="GB2312"></input>
<input type="hidden" name="oe" value="GB2312"></input>
<input type="hidden" name="oe" value="GB2312"></input>
更改后代码:
<input type="hidden" name="ie" value="UTF-8"></input>
<input type="hidden" name="oe" value="UTF-8"></input>
<input type="hidden" name="oe" value="UTF-8"></input>