在vs2005里把html里面的部分英文代码改为中文后再运行出现乱码的解决方法
改写前:
<html>
<head>
<title>ASCIIMathML.js demo</title>
<script type="text/javascript" src="ASCIIMathML.js"></script>
<script type="text/javascript">
translateOnLoad=false;
function display() {
var str = document.getElementById("inputText").value;
var outnode = document.getElementById("outputNode");
var n = outnode.childNodes.length;
for (var i=0; i<n; i++)
outnode.removeChild(outnode.firstChild);
outnode.appendChild(document.createTextNode(str));
AMprocessNode(outnode);
}
</script>
改写后:
<html>
<head>
<title>ASCIIMathML.js demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">//此行是新加的!
<script type="text/javascript" src="ASCIIMathML.js"></script>
<script type="text/javascript">
translateOnLoad=false;
function display() {
var str = document.getElementById("inputText").value;
var outnode = document.getElementById("outputNode");
var n = outnode.childNodes.length;
for (var i=0; i<n; i++)
outnode.removeChild(outnode.firstChild);
outnode.appendChild(document.createTextNode(str));
AMprocessNode(outnode);
}
</script>