如何在mysql中插入阿拉伯字母

Ray*_* Sp 3 php mysql unicode arabic internationalization

我已经遍布网络试图找到一个关于通过HTML和PHP将阿拉伯字母插入mysql的教程

我的HTML页面看起来像这样

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Run Code Online (Sandbox Code Playgroud)

我的php页面是这样的

// Connects to your Database 
mysql_connect("localhost", "root", "") or die(mysql_error()); 
mysql_select_db("castt") or die(mysql_error()); 
mysql_query("SET NAMES 'cp1256'"); 
mysql_query('SET CHARACTER SET cp1256'); 
Run Code Online (Sandbox Code Playgroud)

当我浏览mysql数据库时,它看起来像"?????"

有什么建议吗?

Pek*_*ica 5

cp1256在将输出声明为UTF-8时,您正在使用数据库.那不行.

更换cp1256UTF8可能已经帮助.