On the Internet to find, first stay, for later use, see comments that this is for UTF-8 coding
Found two of the most common methods for the time being.
////////////////////////////////////
The first kind of direct URL coding is more convenient
Js:
[JavaScript] view plain copy <script type= "Text/javascript" > String = encodeURIComponent (string); Location.href = Index.php?keyword= ' +string; </script> ————————————————
Php:
[PHP] view plain copy $keyword = (isset ($_get[' keyword '))? $_get[' keyword ']: "; //////////////////////////////////////////////////////////////////
The second use of escape coding is more complex but concurrent sex seems to be better, passing through Ajax may need
Js:
[JavaScript] view Plain copy ... $.getjson ("admin.php?action=" +escape (Action), function (JSON) {}) ...
Php:
[PHP] view plain copy function unescape ($STR) {//define unescape function $str = UrlDecode ($STR); Preg_match_all ("/(?:%u.{4}|& #x.; | & #d +;|.+)/U ", $str, $r); $ar = $r [0]; foreach ($ar as $k => $v) {if (substr ($v, 0,2) = = "%u") $ar [$k] = Iconv ("Ucs-2be", "Utf-8″,pack (" H4″,substr ($v,-4))); ElseIf (substr ($v, 0,3) = = "& #x") $ar [$k] = Iconv ("Ucs-2be", "Utf-8″,pack (" H4″,substr ($v, 3,-1))); ElseIf (substr ($v, 0,2) = = "&#") {$ar [$k] = Iconv ("Ucs-2be", "Utf-8″,pack (" n ", substr ($v, 2,-1))); } return Join ("", $ar); } $action =unescape ($_get["action"));