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

标签 php mysql unicode internationalization arabic

我找遍了整个网络,试图找到一个关于通过 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">

我的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'); 

当我浏览 mysql 数据库时,它显示为“??????”

有什么建议吗?

最佳答案

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

UTF8 替换 cp1256 可能已经有所帮助。

关于php - 如何在mysql中插入阿拉伯字母,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7386318/

相关文章:

python - 从 csv 中读取俄语数据

html - 在 Swift 中将 Unicode 符号或其 XML/HTML 实体转换为其 Unicode 编号

php - 跟踪最后访问的页面

php - 在 Ubuntu 上安装 Joomla

PHP strstr - 反向方法

php - 查找文件夹外部的文件

php - 建立一个 rss 提要

unicode - 使用 LPeg 匹配 Unicode 标点符号

PHP PCRE 允许字符串中的嵌套模式(递归)

php - ExtJS 4 中多个同时运行的 ajax 请求