internet explorer - php get data on IE (Greek char) does not work -
i have 2 pages , use ajax in order tasks without refreshing page. problem when use internet explorer, got value '?'. try have catalog , when user clicks on character, other page performing sql tasks , first page presents results.
first page:
<html> <head> <meta http-equiv="x-ua-compatible" content="ie=9"/> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script> function loadxmldoc(mylink) { alert ("ok"); var xmlhttp; alert (mylink); if (window.xmlhttprequest) { xmlhttp=new xmlhttprequest(); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4) { document.getelementbyid("information").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("get","select.php?data=" + mylink,true); xmlhttp.send(); } </script> </head> <body> <center> <font size = "4"> <a href = "#" onclick = "loadxmldoc('Ι'); return false;">Ι </a> </font> </center> <div id = "information"> </div> </body> </html>
the second page:
<html> <head> <meta http-equiv="x-ua-compatible" content="ie=9"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body> <?php //var_dump($_get); //exit(); session_start(); $find = $_get["data"]; $find = iconv("utf8", "utf8", $find); echo "new find = " . $find; $find = iconv("utf8", "utf8", "Ι"); //greek character echo "<br/>newest find = " . $find; ?>
the first 'echo' print questionmark ('?') while second 1 print proper character. problem appears on internet explorer, works on other. if use 'var_dump', get:
internet explorer: array(1) { ["data"]=> string(1) "?" }
chrome , mozilla: array(1) { ["data"]=> string(2) "Ι" }
no problem @ ajax.
any please?
i've found best way avoid kind of problem use html entities special characters.
http://www.w3.org/tr/html4/sgml/entities.html
so if want alpha, use Α rather paste alpha in code. if you're loading text database, however, require looking @ character codes , converting entities. easy enough because html entity work ampersand followed pound sign character code value semicolon.
Comments
Post a Comment