为什么用javascript读取asp写的cookie,汉字是乱码了
test.html
<script>
function readCookie(name){
var cookieValue = "";
var search = name + "=";
if(document.cookie.length > 0){
offset = document.cookie.indexOf(search);
if(offset != -1){
offset += search.length;
end = document.cookie.indexOf(";", offset);
if(end == -1) end = document.cookie.length;
cookieValue = unescape(document.cookie.substring(offset, end))
if (cookieValue==""){cookieValue="hello.htm";}
}
}
return cookieValue;
}
</script>
<script>
var cp=readCookie("test");
alert(cp);
</script>
test.asp
<%
response.cookies("test")="这是asp写的cookie"
c=request.cookies("test")
response.write c
%>
========Js读出来的cookie汉字是乱码了 请问如何解决啊