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 inp开发者_如何学Cut what i entered. I am stuck with this place.
Any ideas or suggestion will be helpful and grateful.
thanks in advance..
This problem should be solved in an earlier stage. Arabic character do not fit in a non-unicode databasetable. That's the real problem.
You should use Unicode tables as well as a Unicode connection to your MySQL database.
Set the default character set of your table to utf8 and make sure the connection to your database is also using this character set:
$conn = mysql_connect($server, $username, $password);
mysql_set_charset("UTF8", $conn);
See also: http://nl3.php.net/manual/en/function.mysql-set-charset.php
Check the character set of your current connection with:
echo mysql_client_encoding($conn);
See also: http://nl3.php.net/manual/en/function.mysql-client-encoding.php
When creating your tables do something like this:
create table user (
// Your table definition
) default charset = UTF8
If you have done these things and add a user which contains arabic character to your table, you will see it is displayed correct. Now the comparison will be easy.
Good luck!
I had the same problem but I fixed it.
you can alternatively include a php code below:
mysql_set_charset("UTF8", $conn);
$conn
, is our mysql connection.
you may also need to include the meta tag in your web page:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
hope that helps
Sardar Jaf
精彩评论