Click here to Skip to main content
11,797,944 members (78,759 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: Javascript PHP jQuery
Search is not working on IE, but works great on Chrome, Safari, Opera, Firefox.

it works great when it searches into database english characters on IE 10 but nothing shows as text when it searches into database to find greek characters. This happens only with IE.
<script type="text/javascript" src=""></script>
<script type="text/javascript" src="js/textinputs_jquery.js"></script>
<script type="text/javascript" src="js/textinputs_jquery_src.js"></script>

$("#comp_text").live('input paste',function(){
var str=document.getElementById("comp_text");
if (str.value.length <3){
return false;
var twidth=str.offsetWidth;
$(".add").submit( function(){
return true;
return false;

function showHint(str)
if (str.length==0)
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp. önreadystatechange=function()
if (xmlhttp.readyState==4 && xmlhttp.status==200)

function set_val(str, company){
document.getElementById('comp_text').value= str;
document.getElementById("customer_place").innerHTML='<input type="hidden" id="company" value="'+company+'">';
function cust_control(){

if (document.getElementByName('company')){
alert ("");
return false;
return true;

<form method=\"post\" name=\"addn\" class=\"add\" action=\"do_insert.php\">
<input type="text" id="comp_text" önkeyup="showHint(this.value)" name="company" size="20" style="text-align: center; font-size: 13px;"/>
<div id="txtHint"></div>
<div id="customer_place"></div>

and gethint.php ...

$query="SELECT uid, company FROM users where company like '".$q."%' and userid='$userid' order by company";
mysql_query("set character set 'utf8'");
if (mysql_num_rows($result) > 0) {
    while ($row=mysql_fetch_array($result)){
$response.='<tr><td önclick="set_val(\''.$row['company'].'\', \''.$row['uid'].'')">'.$row['company'].'</td></tr>';
echo $response;
Posted 10-May-13 2:09am
Edited 10-May-13 2:30am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

My guess would be that ms still defaults to its legacy Windows-1252 character encoding. Try put the following as first line in the HEAD section of the page.
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Good luck!
bmaglar at 10-May-13 8:34am
The problem remains the same. When i search on IE for a fantastic company ASD for example it is ok. When i search for a greek characters company of the database it looks like the mysql_num_rows($result)==0
E.F. Nijboer at 10-May-13 8:48am
As a sidenote:
This is an accident waiting to happen (sql injection):
$query="SELECT uid, company FROM users where company like '".$q."%' and userid='$userid' order by company";

But for the sake of just this question, could you describe what you enter and what you see happening? Is the query actually fired in ie10 for example? Did you check the NET tab in the developer tools (key: F12)? Or checked it with fiddler?
bmaglar at 10-May-13 16:25pm
On the Net tab i see the query running real-time correctly with greek characters but $response is null if the characters are greek on IE so it goes to the final else {... }
E.F. Nijboer at 10-May-13 16:37pm
Is this link any help?

By the way, I noticed the character 'ö' instead of an 'o' in the code added to the question and I don't know if that matters.
bmaglar at 10-May-13 17:13pm
Nothing solved ..
E.F. Nijboer at 10-May-13 17:39pm
Too bad... Have to think about it some more. Hopefully something pops into mind.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

solves the problem ...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 CPallini 575
1 Maciej Los 375
2 OriginalGriff 353
3 Abhinav S 342
4 Richard MacCutchan 218
0 OriginalGriff 2,150
1 Maciej Los 1,790
2 KrunalRohit 1,456
3 CPallini 1,415
4 Richard MacCutchan 1,016

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 15 May 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100