I have a database where everything is defined in UTF-8 (charsets, collations, …).
I have a PHP page that gets datas from that database and display it.
That PHP page contains some hard text with special charaters, like é, à, …
My PHP page has meta charset defined to utf-8.
I call mysql_set_charset("utf8");
My PHP page is written on an editor that is configured to encode to utf-8 Unicode (Dreamweaver CS4, there is no other utf-8 option)
Anything coming from the database is ok, but…
I can’t display well the hard special characters (é, à, ù, …).
Same problem when I use strip_tags(html_entity_decode($datafromdatabase)); on datas coming from database. Here it’s really problematic.
What may I do to keep using UTF-8, but being able to display well the special chars without having to use their html equivalent (é, à, ...) ?
EDIT
The problem with hard characters was coming from the php page that was not saved using adhoc encoding. I have created a new document copyed/pasted the old code into that new page, and saved it over the old page. No more problem with hard characters.
But I still have problems with strip_tags(html_entity_decode($datafromdatabase));
using $datafromdatabase = htmlentities(strip_tags(html_entity_decode($datafromdatabase)), ENT_COMPAT, "UTF-8") does not solve the problem. I have stange characters starting with # for each é, à, ù in the text coming from the database (stored as é, ...)
The problem with hard characters was coming from the php page that was not saved using adhoc encoding. I have created a new document copyed/pasted the old code into that new page, and saved it over the old page. No more problem with hard characters.
For the problem coming from
strip_tags(html_entity_decode($datafromdatabase));I had in fact to usestrip_tags(html_entity_decode($datafromdatabase, ENT_QUOTES, "UTF-8"));