MySQL Forums
Forum List  »  Full-Text Search

Arabic in mysql tables
Posted by: yasser eltayeb
Date: August 22, 2011 09:47AM

i use WAMP Server. (windows,apache,mysql,php).

//so important

FIRST :
In phpmyadmin or MySQL :
make sure that Mysql Database is utf.
make sure that the your database and it's tables are utf-general-ci

after connecting to Mysql immidiately (before choosing your DB) make this order.
mysql_set_charset('utf8');

example :

<?php
//connect to MySQL
mysql_connect("localhost", "user", "password") or die(mysql_error());
mysql_set_charset('utf8'); // that's the order.
echo "Connected to MySQL<br />";

//connect to your DB
mysql_select_db("mydb") or die(mysql_error());
echo "Connected to Database";
?>


SECOND :
in the meta data in the php file make the meta data as following :
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Third :
Make sure that the php file it self is utf-8 enabled . u can make sure in your IDE settings , or if u work on notepad++ or Komodo Edit then u can find it in the status bar at the bottom of the window , right side.



// i tried this but it didn't have effect.

in the header of the php file (before every thing).
<?php header("Content-type: text/html; charset=utf-8"); ?>

in the form submitted:
<form accept-charset="utf-8" ...>

i hope it will help u , i took me 2 days searching to get it :)

Options: ReplyQuote


Subject
Views
Written By
Posted
Arabic in mysql tables
9303
August 22, 2011 09:47AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.