I can't get my php/html pages to display characters with accents (é, á ) correctly. My database is set up correctly. When I run show variables like 'char%
I get satisfactory output:
character_set_client utf8
character_set_connection utf8
character_set_database utf8
character_set_filesystem binary
character_set_results utf8
character_set_server utf8
character_set_system utf8
character_sets_dir /usr/share/mysql/charsets/
Data is encoded and stored correctly in the DB when I insert it from a form on my site.
But something weird happens on my display page.
If I put header('Content-Type: text/html; charset=utf-8');
at the top just inside the php opening tag, data from my DB is displayed correctly but characters that I type manually into the page within HTML tags (as Table Column Headers or just descriptive para text) display with rubbish: �.
If I REMOVE header('Content-Type: text/html; charset=utf-8');
from the top of the page, data from my DB is displayed INCORRECTLY but the text that I write into the page within HTML is fine.
I've tried everything I know. Has anyone come across this before?