Reputation: 13315
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..
Upvotes: 0
Views: 1573
Reputation: 1
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
Upvotes: 0
Reputation: 8046
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: https://www.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: https://www.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!
Upvotes: 1