How to save text field input into mytable as utf8 encoded data, since textarea input automatically changing into utf8 encoded data,
2条回答 默认 最新
dongxian0320 2013-10-07 09:27关注Firstly, make sure that your database table is set to character set UTF-8.
Secondly, set the page your are submitting data from as UTF-8 with the following meta tag:
<head> <meta charset="UTF-8"> </head>Then when making your connection to the database you can execute the following query to set any subsequent queries to the UTF-8 character set too:
query("SET NAMES utf8");See: SET NAMES utf8 in MySQL? and http://www.w3schools.com/tags/att_meta_charset.asp
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报