当您网站出现百度分享上面的图片乱码,或者其他分享功能的文字乱码了,说明分享代码中引用的js文件与您的页面编码不同。 解决方法:网站后台--网站管理--分享按钮,找到多行文本框中的分享代码,在其中</script>标签的前面加上 charset="gb2312" ,例如 charset="gb2312" </script> 这种形式。如果刷新乱码的页面后仍然乱码,就把gb2312换成utf-8即可。 详细举例如下: <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"1","bdSize":"24"},"slide":{"type":"slide","bdImg":"2","bdPos":"left","bdTop":"250"},"image":{"viewList":["qzone","tsina","tqq","renren","weixin"],"viewText":"分享到:","viewSize":"16"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["qzone","tsina","tqq","renren","weixin"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)]; </script> 把最后面的</script>前面加上charset="gb2312"就是: <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"1","bdSize":"24"},"slide":{"type":"slide","bdImg":"2","bdPos":"left","bdTop":"250"},"image":{"viewList":["qzone","tsina","tqq","renren","weixin"],"viewText":"分享到:","viewSize":"16"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["qzone","tsina","tqq","renren","weixin"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)]; charset="gb2312"</script> 如果上面试了gb2312 和 utf-8 都不行的话,就重新到百度分享中,获取不带图片分享的代码,因为这是百度的问题,是百度的代码,我们也没有更好的解决方案。 网址:http://share.baidu.com/code 记得不要勾选“图片分享功能” |
上一篇:手机版可以关闭么?