jq的get传参数在utf-8中乱码问题的解决php版
作者:
在php下用jquery传参出现乱码的解决方法
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script>
document.write(escape("哈哈")+"<br>");
document.write(unescape("%u54C8%u54C8")+"<br>");
document.write(encodeURIComponent("哈哈")+"<br>");
document.write(decodeURIComponent("%E5%93%88%E5%93%88")+"<br>");
</script>
</head>
<body>
<?php
echo urldecode("%E5%93%88%E5%93%88");
echo "<br>";
echo rawurldecode("%E5%93%88%E5%93%88");
echo "<br />";
echo utf8_decode("%E5%93%88%E5%93%88");
echo "<br />";
echo "%E5%93%88%E5%93%88";
echo "<br />";
echo $_GET['act'];
echo "<br />";
echo urlencode($_GET['act']);
?>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script>
document.write(escape("哈哈")+"<br>");
document.write(unescape("%u54C8%u54C8")+"<br>");
document.write(encodeURIComponent("哈哈")+"<br>");
document.write(decodeURIComponent("%E5%93%88%E5%93%88")+"<br>");
</script>
</head>
<body>
<?php
echo urldecode("%E5%93%88%E5%93%88");
echo "<br>";
echo rawurldecode("%E5%93%88%E5%93%88");
echo "<br />";
echo utf8_decode("%E5%93%88%E5%93%88");
echo "<br />";
echo "%E5%93%88%E5%93%88";
echo "<br />";
echo $_GET['act'];
echo "<br />";
echo urlencode($_GET['act']);
?>
</body>
</html>
您可能感兴趣的文章:
- PHP iconv 解决utf-8和gb2312编码转换问题
- PHP乱码问题,UTF-8乱码常见问题小结
- php中utf-8编码下用正则表达式如何匹配汉字
- php中隐形字符65279(utf-8的BOM头)问题
- php中json_encode UTF-8中文乱码的更好解决方法
- php utf-8转unicode的函数
- PHP utf-8编码问题,utf8编码,数据库乱码,页面显示输出乱码
- php中文乱码怎么办如何让浏览器自动识别utf-8
- PHP 截取字符串函数整理(支持gb2312和utf-8)
- php UTF-8、Unicode和BOM问题
- PHP如何实现Unicode和Utf-8编码相互转换
- php smarty截取中文字符乱码问题?gb2312/utf-8
- PHP 与 UTF-8 的最佳实践详细介绍