<html>
<head>
<meta http-equiv=Content-Type content="text/html;charset=gb2312">
<title>method=GET</title>
<style>
.bw{width:100px;}
</style>
<script type="text/javascript">
function utf(){
var q = document.getElementById('intext').value;
document.getElementById('intext').value=encodeURI(q);
}
</script>
</head>
<body>
<br/>
<form method="GET" action="http://so.cntv.cn/search.php" name="searchform" id="searchform">
<input type="text" name="qtext" id="intext" class="input_search" value="" />
<input class="bw" type="submit" value="cntv";/>
<input class="bw" type="button" value="change" onclick="utf();"/>
</form>
</body></html>cntv是UTF-8编码
我试了encodeURI ,还是不行
比如我搜索“第一时间”按第二个按钮后成功转成了%E7%AC%AC%E4%B8%80%E6%97%B6%E9%97%B4
可是提交后变成了%25E7%25AC%25AC%25E4%25B8%2580%25E6%2597%25B6%25E9%2597%25B4
每个百分号右边被插入了“25”我如果把本地htm改成utf-8的话,网页里面的中文都成了乱码。