user1427811
user1427811

Reputation:

decode in PHP a simple text from database

I have a simple text into my database with a string like this: "Online il nuovo sito web di QINT'X: rinnovato nella grafica presenta una struttura più lineare e facilmente fruibile rispetto al precedente, a tutto vantaggio della navigazione"

I have make a query in PHP to retrieve data but when I take the string doesn't decode the character'ù'. Why? This is my code (I have hidden the part of query because the problem I think is in the utf8_decode):

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

Upvotes: 0

Views: 168

Answers (1)

Roman Newaza
Roman Newaza

Reputation: 11690

You should set encoding when you connect the DB.

SET NAMES 'utf8'

Upvotes: 1

Related Questions