在一个Asp页面中页面正常的中文字符都没有问题,但如果用Asp程序输出的话就显示为乱码
终于在百度经验上找到解决方案:
1.将文件编码更改为Utf-8
![](https://i-blog.csdnimg.cn/blog_migrate/354edbafef99d0ab453773725bb909db.png)
2.在页头添加"<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>"
3.在页面title里添加Content-Type的meta指定页面编码
“
<meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=utf-8"
/>”
完整的代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <!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" /> </head> <body> HTML测试是否是乱码<br> </body> </html><% response.write("Asp程序输出中文") %>
页面输出结果(经测试条件2去掉后并没有出现乱码,但最好加上)
![](https://i-blog.csdnimg.cn/blog_migrate/baacd501c5fd7838aa0428003b648bee.png)
如果文件编码为ANSI则页面显示为乱码
![](https://i-blog.csdnimg.cn/blog_migrate/45dc16ccde8db09d086a477cbb321a0c.png)
如果文件编码是Unicode则显示为asp错误,大意是asp不支持UNICODE 编码
"Active Server Pages error 'ASP 0239'
Cannot process file
/callback.asp, line 1
UNICODE ASP files are not supported."
![](https://i-blog.csdnimg.cn/blog_migrate/ccac9d0bf82b5e5ab430d3ccb9e60b6c.png)
参考:
百度经验怎样解决ASP中文乱码?