1

I am building a web site with database in Hebrew (using php and mysql). on general I use chrome to test my job... today I tried explorer :-0 (yeh... you must be thinking "why the f*** would he do it... ;) ). I found out that all the data that is sent from explorer is stored in ????? and cannot be used.

I use <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> on the main page

and header('Content-Type: text/xml charset=utf-8'); on the php page that sends the xml files (after he receives get request)

on my connect.ini.php I included the following code:

mysql_query("SET NAMES 'utf8'",mysql_connect($host, $user, $password));

my ajax javascript is:

if(xmlHttp.readyState==4||xmlHttp.readyState==0){
   gender=document.getElementById("gender").value;                                                                                       
   xmlHttp.open("GET","file.php?gender="+gender , true);                                                                                    
   xmlHttp.send(null);
   }else{
        setTimeout('submit_quick_start_form()',1000);   
   }

as i said before in chrome everything is fine...

Please help guys...

misha312
  • 1,443
  • 4
  • 18
  • 27
  • can you clarify this ... so User A sends data to your web server in Chrome you receive this data save it to MySQL, User B sends data to your web server in IE you receive this data save it to MySQL, User C goes to your site in Any Browser and you output User A input and User B input and User B input is ????? instead of the correct characters? – cmorrissey Jun 02 '15 at 20:17
  • yep only I not output it... I look in php-my-admin and see the disaster... I guess if I output it chrome wont understand the ???? – misha312 Jun 02 '15 at 20:25
  • possible duplicate of [Setting the character encoding in form submit for Internet Explorer](http://stackoverflow.com/questions/153527/setting-the-character-encoding-in-form-submit-for-internet-explorer) – technophobia Jun 02 '15 at 20:25
  • @misha312 have a look at the link I posted, it may have your solution (IE Hack) – technophobia Jun 02 '15 at 20:26
  • @misha312 how are you submitting the form data? ajax? or is it a straight post? – cmorrissey Jun 02 '15 at 20:32
  • I am using ajax (with method get)... ok I found something... whem i delete the charset=utf-8 from the main page my whole page is in unreadable language but the input to the database is good (normal Hebrew) its like some double conversion issue – misha312 Jun 02 '15 at 20:39
  • By the wey I tried the hack and it didnt work – misha312 Jun 03 '15 at 07:19
  • please update your question with your `js` ajax submit code – cmorrissey Jun 03 '15 at 13:46
  • Where is comment about `mysql_` functions ? :) – vp_arth Jun 04 '15 at 04:27

1 Answers1

1


(click for full size)

Shown in the first 3 GETs, in order, I found that Chrome, Firefox, and IE all produce different results. But I guess theoretically, Firefox does it right. In any case, they all give the same result (next 3 GETs in order), if we encodeURIComponent() the input.value. Like such:

xhr.open('GET', location.href+"?"+encodeURIComponent(test.value), true)
......
<input type=text id=test name=test value="שלום מישה">

user4749485
  • 1,028
  • 7
  • 10
  • So let me understand I need to insert encodeuricomponent to my javascript in order to solve this problem?? – misha312 Jun 04 '15 at 08:12