0

My question in brief here:

The site is developed with PHP as front end and mysql as backend.

I am registering in my site by entering the arabic letters. And the value also inserted in mysql database. But it is not in the format what i entered. It looks like junk words.

Now my problem is when i try to login i can't able to match the input what i entered. I am stuck with this place.

Any ideas or suggestion will be helpful and grateful.

thanks in advance..

4

2 回答 2

1

这个问题应该在更早的阶段解决。阿拉伯字符不适合非 unicode 数据库表。这才是真正的问题。

您应该使用 Unicode 表以及与 MySQL 数据库的 Unicode 连接。

将表的默认字符集设置为 utf8 并确保与数据库的连接也使用此字符集:

$conn = mysql_connect($server, $username, $password);
mysql_set_charset("UTF8", $conn);

另见: http: //nl3.php.net/manual/en/function.mysql-set-charset.php

检查当前连接的字符集:

echo mysql_client_encoding($conn);

另见: http: //nl3.php.net/manual/en/function.mysql-client-encoding.php

创建表时,请执行以下操作:

create table user (
    // Your table definition
) default charset = UTF8

如果您已完成这些操作并将包含阿拉伯字符的用户添加到您的表中,您将看到它显示正确。现在比较会很容易。

祝你好运!

于 2010-10-22T14:16:35.630 回答
0

我有同样的问题,但我解决了。

您也可以在下面包含一个php代码:

mysql_set_charset("UTF8", $conn); $conn,是我们的mysql连接。您可能还需要在网页中包含元标记:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 

希望有帮助

萨达尔·贾夫

于 2010-11-08T20:41:38.163 回答