开发者

Facebook Share button encoding problem

开发者 https://www.devze.com 2022-12-18 19:47 出处:网络
I am trying to make a Facebook share button on my site. Everything goes well except Facebook garbles non-ascii symbols obtained from meta tags. For example:

I am trying to make a Facebook share button on my site. Everything goes well except Facebook garbles non-ascii symbols obtained from meta tags. For example:

I am sharing a page with URL http://example.com/facebook/. The page at http://example.com/facebook/ has the following meta tags inside its HTML:

<head>
...
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
...
<meta name="title" content="John Smith won £10000!" />
<meta name="description" content="Wanna be next John Smith?" />
<link rel="image_src" href="http://example.com/img/logo.jpg" />
...
</head>

The problem is that a pound (£) sign is shown as � symbol in Facebook share pop-in, that's not a desired behaviour.开发者_高级运维

I would be grateful for any thoughts.


I would recommend replacing the pound-sign with the equivalent entity, i.e. &#163; = £. You may also need to add a charset definition, e.g. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> In fact, you might be able to get away with just the meta tag -- just put it before the others.

0

精彩评论

暂无评论...
验证码 换一张
取 消