从php到MySQL表的阿拉伯字符串 [英] Arabic strings from php to MySQL tables
问题描述
print
来显示字符串,但是当我使用PDO将这个字符串添加到表中时,在phpMyAdmin中,我看到这个字符串的记录是一堆的问号(?)和其他字符。我环顾四周,正在发生什么事情,而我看到的一件事就是将整理更改为 cp1256_general_ci
,但是这样一来,一堆问号(?)和其他字符。 我在Mac上使用MAMP,但是因为我看到cp1256是windows,我现在在Windows上使用XAMPP。
如何将阿拉伯字符串添加到表格中,并且能够在phpMyAdmin中正常显示?
编辑:
我试图用奇怪的字符串查询表,看看它是否有效,但是我有黑色菱形和问号。
你必须做这三件事,你去那里
-
将您编辑的程序的编码更改为UTF-8。
-
2-放入您的php文件
< meta http-equiv =Content-Typecontent =text / html; charset = utf-8/>
-
3-将数据库中的排序规则放入UTF-8
在结尾使用UTF-8无处不在。
I have an array of Arabic strings, and I want to add them to my tables in MySQL. I can display the strings using the php print
normally, however, when I add this string to the table using PDO, in phpMyAdmin, I see the record of this string as a bunch of question marks (?) and other characters. I looked around for what is happening, and one of the things I saw was to change the collation to cp1256_general_ci
however this keeps the same things, a bunch of question marks (?) and other characters.
I was using MAMP on mac, but because I read that cp1256 is windows, I am using XAMPP on windows now.
How can I add the Arabic strings to the table, and be able to see them in phpMyAdmin normally?
EDIT:
I tried to query the table with the weird strings to see if it works, but I got black rhombus shapes and question marks.
you have to do those three things and there you go
1- change the encoding of your editor programm which you use to UTF-8 .
2- put in your php files this
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3- put the collation in your database to UTF-8
in conclusion use UTF-8 everywhere.
这篇关于从php到MySQL表的阿拉伯字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!