html - The database does not collect the content other than English [Charset/Unicode set to UTF-8] -
i have moved server dreamhost godaddy recently
when dreamhost no problem when visitors submitting form in website using other language english.
for example use thai language when submit form receive no problem.
but happen when submit form receive text ??????????
though might setting on php.ini file if set correctly , see using utf-8
; php's built-in default text/html default_mimetype = "text/html" default_charset = "utf-8"
and
exif.encode_unicode = "utf-8" exif.decode_unicode_motorola = "ucs-2be" exif.decode_unicode_intel = "ucs-2le" ;exif.encode_jis = exif.decode_jis_motorola = jis exif.decode_jis_intel = jis
but can't figure out why happen while set correctly
and each of html/php header file have included
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
any suggestion missed?
to put more information that
if use ftp client such filezilla there problem when edit file .php or .html content in file if has other language english go question mark ???????
if edit web net2ftp has no problem on that
i had similar problem php + mysql, mysql refused store utf8 strings. solution tell mysql each time after connection, use utf8. believe sql command set character set utf8
, or set names utf8
i'm not sure, long ago.
edit: found old php code of mine, hope helpful:
function sql_connect(){ global $host,$user,$pass,$dbname,$conn; // connect mysql $conn=mysql_connect($host,$user,$pass); // if cannot connect, exit if(!$conn){ die('cannot connect mysql server: '.mysql_errno().' - '.mysql_error()); }; // if cannot set utf8, exit if(!mysql_query('set names utf8;',$conn)){ mysql_close($conn); die('cannot set utf8: '.mysql_errno().' - '.mysql_error()); }; // if cannot select database, exit if(!mysql_select_db($dbname,$conn)){ mysql_close($conn); die('cannot select database: '.mysql_errno().' - '.mysql_error()); }; }; function sql_to_html($x){ return(htmlspecialchars(stripslashes($x),ent_quotes,"utf-8")); };
Comments
Post a Comment