Question

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.

Was it helpful?

Solution 2

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top