Unicode everywhere! — Nov 2, 2012, 11:33 am
To prevent any hieroglyphics on your website, make sure everything is in the right format. Here is a full range example for Unicode (UTF-8).First make sure that you safe every file (.php, .js, .css, etc.) correctly under the UTF-8 encoding. If you use UTF-8 with BOM you might get some disturbing space in the beginning of your web document.
For PHP:
header('content-type: text/html; charset=utf-8');
For HTML:
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />...or short in HTML5:
<meta charset="utf-8" />
Not exactly necessary, but also possible is a tagwise setting, i.e. for submitted form data:
<form accept-charset="utf-8">...</form>
For MySQL:
SET NAMES 'utf8'; SET CHARACTER SET utf8;
Additionally:
SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8';