在mysql表中插入波斯文字 [英] Insert a persian text in mysql table
问题描述
我想将一个表单的值(用php)存储到mysql中,一个字段是文本,并且该字段的值使用波斯语,当我将数据插入表中时,该波斯文本存储以这种形状显示:???????
I want to store values of a form (in php) into mysql , one field is text and values of this field is in persian language , when I insert data to table this persian text stores in this shape : ???????
我使用这些代码,但不能正常工作
I use these codes but it isn't work properly
mysql_set_charset('utf8',$db);
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET NAMES utf8_persian_ci");
表,数据库和列具有utf8_persian_ci排序规则
tables ,database and columns has utf8_persian_ci collation
推荐答案
确保排序规则为utf8.排序规则persiab不区分大小写的字符可能无法正常工作,因为输入的字符代码可能不在波斯语字符的范围内. unicode 8将起作用.将排序规则更改为utf8_general
make sure the collation is utf8. collation persiab case insensitive may not work properly as the input char code may not be in range of persian charachters. unicode 8 will work. change the collation to utf8_general
这篇关于在mysql表中插入波斯文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!