php - How to save text field input to table as utf8 encoded data automatically? -
how save text field input mytable utf8 encoded data, since textarea input automatically changing utf8 encoded data,
firstly, make sure database table set character set utf-8.
secondly, set page submitting data utf-8 following meta tag:
<head> <meta charset="utf-8"> </head>
then when making connection database can execute following query set subsequent queries utf-8 character set too:
query("set names utf8");
see: set names utf8 in mysql? , http://www.w3schools.com/tags/att_meta_charset.asp
Comments
Post a Comment