<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>在线阅读</title>
</head>
<body>
<%@ include file="files.txt" %>
</body>
</html>在files.txt文件中的中文汉字是乱码,txt保存时的编码我也设成了utf-8
这是为什么,怎样解决?
pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>在线阅读</title>
</head>
<body>
<%@ include file="files.txt" %>
</body>
</html>在files.txt文件中的中文汉字是乱码,txt保存时的编码我也设成了utf-8
这是为什么,怎样解决?
JSP 用UTF-8编码
采用
<jsp:include page="files.txt"> </jsp:include>
方式
1 改名files.txt为 filex.jsp
2 在文件最前面加上
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%> 这个就和一般的jsp文件没啥区别了,别的能include进来,这个也可以。
3 当然文件为UTF-8编码了
4
<jsp:include page="files.jsp"> </jsp:include>