用PHP解码数据库中的一个简单文本


decode in PHP a simple text from database

我在数据库中有一个简单的文本,其中包含这样的字符串:

我用PHP进行了一个查询来检索数据,但当我获取字符串时,不会解码字符"。为什么?这是我的代码(我隐藏了查询的部分,因为我认为问题在utf8_decode中):

echo'<span class="txt_page" style="text-align:justify">'.utf8_decode(htmlentities(substr($news['descrizione_it'],0,200))).'</span><br />';

连接数据库时应设置编码。

SET NAMES 'utf8'