Best method for pre and post processing multilingual user input for a php/mysql CMS -


OK, there is a ton of stuff over the string, but very little, that I can find best methods < / P>

I am creating two multilingual (Japanese, English + other Romance languages), to create user input to include content management system (like I'm typing now), CMS And to display with Japanese characters, especially There is one cat of the time to get two types of special characters.

I have to keep getting very inconsistent results.

I have everything UTF-8:

web page: and

. Htaccess file: AddDefaultCharset UTF-8 and (to emphasize this issue)

After each DB connection: mysql_query ("SET NAMES 'UTF8'");

Each database, table, and field is also set to utf8_general_ci

. I first preprocess user input with the default settings of htmlimpifier, I run it on:

prefix function html_encode ($ var) {// encoded HTML to safely use the UTF-8 instead of brain $ var = HTMLentities ($ var, ENT_QUOTES, 'UTF-8'); Change the special characters in the console to Unicode $ Look = array ('' ',' & 'trade;', '®', '& amp; reg;'); $ Secure = array ('& amp; # 8482;', '& # 8482;', '& # 174;', '& amp; # 174;'); $ Var = str_replace ($ look, $ safer, $ var); $ Var = mysql_real_escape_string ($ var); Return $ Var; }

It is found in the database.

'UTF-8'); }

Unfortunately, even then I can get incompatible results. Most often the ® symbols become little diamonds.

I have searched for everyone for a good tut on this, but it can not seem to know what is the best way to ...

Sorry the web page header was cleared by the wysiwyg editor. For clarity:

Web page headers are:

  & lt ;! DOCTYPE html public "- // W3C // DTD XHTML 1.0 Transcription // N http: //www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  

and

  & lt; Meta http-equiv = "content type" content = "text / html; charset = UTF-8" />  

Comments