Cyrillic, AJAX and database
I save form data in a MySQL database with native AJAX. In file 1 (where is the form and AJAX) I have
<meta 开发者_JAVA技巧http-equiv="Content-Type" content="text/html; charset=utf-8" />
and
mysql_query("SET CHARACTER SET utf8");
In file 2 (database submission) I have
mysql_query("SET CHARACTER SET utf8");
iconv_set_encoding("internal_encoding", "UTF-8");
iconv_set_encoding("output_encoding", "UTF-8");
iconv_set_encoding("input_encoding", "UTF-8");
and
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+
mysql_query("ALTER TABLE `rss` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci");
and I echo the variable from send AJAX - it is in Cyrillic . The file encoding is UTF-8 without BOM. Any ideas? In DB - table collation - utf8_unicode_ci
Try
mysql_query("SET NAMES utf8");
instead of SET CHARACTER SET
精彩评论