It is not so difficult, but you can ask your question a little more specifically.
If you are talking to a database, make sure that your database stores data in UTF-8 and that the connection to your database is in UTF-8 (common error). Remember to run this when establishing the connection:
mysql_set_charset('utf8');
For user input, set the accept-charset attribute on your forms.
<form accept-charset="utf-8">
Submit your sites with the appropriate HTTP header:
header('Content-Type: text/html; charset=utf-8');
or at least set the appropriate meta tags for your site:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Save the source code files encoded in UTF-8.
If you keep everything in UTF-8, you usually don't need to worry about anything. This becomes problematic only after you start mixing encodings throughout the application.
If you start talking about string manipulation, of course, you have to take care a bit. Basically you want to use the mb_ set of string functions, as you indicated yourself.
deceze Jul 06 '09 at 2:29 2009-07-06 02:29
source share