这些HTML实体只是以纯文本显示的原因吗?

时间:2014-11-14 10:52:15

标签: html wordpress html-entities

我在我的Wordpress网站上安装了BBPress,其中一个帖子包含了这个文本块:R&ॐ pH&#127917,它们呈现如下:“R&pH?”

我希望它在我的页面上呈现,但由于某种原因,它只是以纯文本显示,就像上面的第一个实例一样。

我已尝试在我的网页的<head>中设置以下HTML元数据值:

<meta charset="UTF-8"> 
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">

HTTP标头如下所示:

http://redacted.com/forums/topic/slug

GET /forums/topic/they-died-with-their-boots-on/ HTTP/1.1
Host: redacted.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cache-Control: max-age=0

HTTP/1.1 200 OK
Date: Fri, 14 Nov 2014 10:41:32 GMT
Server: Apache/2.2.22 (Debian)
X-Powered-By: PHP/5.4.4-14+deb7u14
X-Pingback: http://redacted.com/xmlrpc.php
Link: <http://redacted.com/?p=202>; rel=shortlink
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 5204
Keep-Alive: timeout=5, max=98
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8

不确定接下来要尝试什么。

感谢阅读。

1 个答案:

答案 0 :(得分:1)

这与编码无关。 &#1234;部分是一个授权的unicode字符(1234是代码点)。

要防止它被授权,只需将&符号替换为&符号实体:&amp;,这样渲染的HTML应如下所示......

R&amp;&amp;#2384; pH&amp;#127917

...然后会像这样呈现:

  

的R&amp;&安培;#2384; pH值安培;#127917