Reputation: 5
When I try that line:
echo "<script >alert(' مشترك بالفعل!'); location.href='index.php';</script>";
in chrome it display garbage but firefox display it correctly. What's wrong with chrome?
Any help will be appreciated. Thanks!
Upvotes: 0
Views: 528
Reputation: 449703
That is because, firefox rockssss – The COMPLETE PHP Newbie 47 secs ago
That comment is probably right (although maybe accidentally. :) Firefox may be sniffing the document's encoding with more flexibility than Chrome is.
The most likely explanation is that your HTML document's encoding is not defined, and the PHP source file (where you store the text in) is stored in a different encoding than you are outputting.
Make sure the encoding of the PHP file, and the HTML document you're outputting, match.
The encoding of the PHP source file can probably be set in your IDE
The encoding of the HTML page is defined by the Content-type
header your web server sends, and/or the Content-type
META tag.
This question gives a complete overview: UTF-8 all the way through
Upvotes: 1