2

I'm trying to use jQuery to get autocomplete from a database. It works fine with English values but I have some rows in Arabic and they are showing as (????).

I start all my pages with:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<Link href="style2.css" rel="stylesheet" type="text/css">
<style type="text/css"></style>

My database is formatted in UTF8. I also include the connection to DB file which says :

$conn = mysql_connect("localhost","root","") or die ($dberror1);
mysql_select_db("finishing", $conn);
mysql_query("SET NAMES 'utf8'"); 
mysql_query('SET CHARACTER SET utf8')

Note: all my other items in Arabic work fine. It's just the jQuery autocomplete that I am having issues with.

Ren
  • 1,111
  • 5
  • 15
  • 24
Hussam Sibai
  • 97
  • 2
  • 9

2 Answers2

0

Change the charset type in meta tag:

<meta http-equiv="Content-Type" content="text/html; charset=charset=iso-8859-6">

charset=iso-8859-6 is used to support the Arabic language in HTML page on browser.

EDITED:

Well This will be helpful to you sure.

<script type="text/javascript" charset="ISO-8859-6">
// your code from where you are making the auto complete 
// either ajax request or any thing
</script>

Just add this charset in your script tag.

For more information see link.

Community
  • 1
  • 1
Code Lღver
  • 15,573
  • 16
  • 56
  • 75
  • @HussamSibai try with `charset=windows-1256`. may be this will be helpful to you? – Code Lღver Apr 25 '13 at 12:59
  • just to make sure i explained myself well ..the whole page shows fine , including the arabic charachters ..the only problem is with the field that shows jquery autocomplete results from the data base ..thank you – Hussam Sibai Apr 25 '13 at 13:02
  • i been trying with it all afternoon but nothing .. im starting to think this would have to do with changing the script within the .js file – Hussam Sibai Apr 25 '13 at 17:16
0

Ok it is solved , simply by including the connection to DB script in the search file , apparently when i was referring to an external file there was a conflict of variables. The script that worked is exactly what i previously posted .. What amazed me though, is that i spent all day looking thru the internet and there aren't any clear answers to the non-unicode problem .. Therefore i advise (in my humble opinion to always include these 4 lines of script in all your files in you are working in a non unicode language ..thankyou for everyone who tried to help

Hussam Sibai
  • 97
  • 2
  • 9