asif hameed
asif hameed

Reputation: 11

displaying non-english characters as ????? in Internet explorer

I'm posting values of 3 text fields,(English, Chinese and Arabic) to a php page using AJAX.

When I try to echo the values in Internet Explorer, I get "????"

The same code works fine in Firefox, Chrome and Safari.

I've already defined the UTF-8 Character set.

Here's my .JS file

xmlhttp.open("GET","save_banner.php?banner1="+b1+"&banner2="+b2+"&banner3="+b3 , true);

.PHP file

header('Content-Type: text/plain; charset=UTF-8');


echo $_GET['banner1'];
echo $_GET['banner2'];
echo $_GET['banner3'];

How can I solve this issue?

Upvotes: 1

Views: 451

Answers (3)

Asif Hameed
Asif Hameed

Reputation: 1

I have got the solution :)

If you try to post the data using ajax than you have to encode the url using the encodeURIComponent() or escape() functions. It works for me.

Upvotes: 0

Jay Sidri
Jay Sidri

Reputation: 6406

Are you testing with IE8? I had this weird issue with IE8 where it refused to display non-english character sets

Add this to the <head> and see if it helps

<meta http-equiv="X-UA-Compatible" content="IE=7" />

It basically forces IE8 to render like IE7 ala 'quirks mode'. Annoying, but it solved the issue for me at least.

Upvotes: 0

Fredrik
Fredrik

Reputation: 1302

Hi Try without the metatag charset="UTF-8" but make sure your file is saved with UTF-8 encoding.

Upvotes: 2

Related Questions