87,922
社区成员
发帖
与我相关
我的任务
分享
<!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>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="yixianggao@126.com" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<!-- 这句是关键! -->
<meta http-equiv="content-type" content="text/html;charset=gb2312">
</head>
<body>
<script type="text/javascript">
<!--
var hello = "你好";
document.write(document.charset + "<br />");
document.write(encodeURI(hello));
// gb2312
// %E6%B5%A3%E7%8A%B2%E3%82%BD
// utf-8
// %E4%BD%A0%E5%A5%BD
//-->
</script>
</body>
</html>
var str = "你好";
str = str.replace(/[^\u0000-\u00FF]/g, function($0) { return escape($0).replace(/(%u)(\w{4})/gi, "&#x$2;") });