阿拉伯语PDF表单到PHP到MYSQL,Unicode解码? [英] Arabic PDF Form to PHP to MYSQL, Unicode Decoding?

查看:187
本文介绍了阿拉伯语PDF表单到PHP到MYSQL,Unicode解码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Acrobat专业人员创建一个PDF表单,表单填充阿拉伯语,我创建了一个PHP文件,以获取表单字段并将其插入到mysql数据库,我尝试用utf_encode解码阿拉伯语文本ãÍã( )和utf_decode()这个词是محمد,数据库是utf8_bin。和解决方案?

I am using Acrobat professional to create a PDF Form, the form is filled with arabic, and I created a PHP file to get the form fields and insert it into a mysql database, I tried decoding the arabic text ãÍãÏ with utf_encode() and utf_decode() the word is محمد and the database is utf8_bin. and solutions?

<?php
error_reporting(E_ALL & ~E_NOTICE);
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "dbTest";

if (isset($_POST['txtName'])) {$txtName= $_POST['txtName'];};

$link = mysqli_connect($servername, $username, $password, $dbname) or     die("UNable to connect");
$qq1 = "set character_set_server='utf8'";
$qq2 = "set names 'utf8'";

//mysqli_query($link, $qq1) or die(mysqli_error($link));
//mysqli_query($link, $qq2) or die(mysqli_error($link));
//$txtName = iconv("UTF-8//TRANSLIT//IGNORE", "Windows-1252//TRANSLIT//IGNORE", $txtName);
//$txtName = iconv("Windows-1256//TRANSLIT//IGNORE", "UTF-8//TRANSLIT//IGNORE", $txtName);

$query = "INSERT INTO  tblTest Values('$txtName')";

mysqli_query($link, $query) or die(mysqli_error($link));

?>
,这里是数据库

?> and here is the database

CREATE TABLE IF NOT EXISTS `tbltest` (`txtName` varchar(244) COLLATE tf8_bin DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;


INSERT INTO `tbltest` (`txtName`) VALUES
('ãÍãÏ Úæäí ãÍãæÏ');


推荐答案

仍然不清楚如何提交数据, answer在上述模拟问题中提供。

It's still not clear how you submit the data but the answer is available in the mentioned simliar question.

在PDF 2.0之前,标准提交操作的字符集不能由PDF规范指定/调整,并且读者应用程序可以选择任何适当的字符集。

The charset for a standard submit action is not specified/adjustable by the PDF specification until PDF 2.0 and the reader application may choose any appropriate charset.

使用JavaScript操作以特定字符集而不是提交操作提交表单数据:

Use a JavaScript action to submit the form data with a specific charset instead of a submit action:

submitForm({
    cURL: "https://www.example.com/your-script.php",
    cSubmitAs: "HTML",
    cCharset: 'utf-8'
});

这篇关于阿拉伯语PDF表单到PHP到MYSQL,Unicode解码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆