Web Development with UTF8
There are two mappings: the numerical value corresponding to a character (charset) and the binary representation of that value (encoding). UTF is a charset that has a number of encodings; utf8 is an encoding.
Thanks to utf, we can have different languages on the same webpage.
First of all, make sure the encoding of your text editor is utf8.
PHP
header("Content-Type: text/html; charset=utf-8");
You don’t need that if you managed to edit your httpd.conf properly.
As long as you don’t want to mess with the content of a string, you can pass it around blindly. But as soon as you want to use any function that relies on substring operations (such as substring, wordwrap, chunk_split) you need to use the equivalent multibyte functions, obtaining prepending mb_ (you need to install the extension on PHP)
MySQL
Similar to PHP (careful with substring and fulltext indexing) but no problem if the charset of the db is UFT8
Similar to HTML, just use:
<meta http-equiv=”content-type” content=”text/html; charset=utf-8″ />
The problem is that that meta applies only to the body but it’s quite likely you need UTF8 also for the to/from header. In that case you need a trick you can find on Google
HTML
<meta http-equiv=”content-type” content=”text/html; charset=utf-8″ />
Javascript
It fully supports UTF8 apart from the escape() function. Google the utf8 version if you need it.
User Input
No problem with the user input because the browser sends data back to the server using the same encoding the server is using. But there are some exceptions (very old browsers, hacking attempts,…)