用jsp页面以流文件形式获取word文档显示全是乱码 怎么解决呀
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="java.io.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
</head>
<body>
<%
File file = null;
FileInputStream fis = null;
try{
String filePath = application.getRealPath("/").replace("\\","/") + "file/readme.doc";
file = new File(filePath);
fis = new FileInputStream(file);
byte[] buffer = new byte[1024];
while(-1 != (fis.read(buffer,0,buffer.length))){
String str = new String(buffer,"UTF-8");
out.print(str);
}
}
catch(Exception ex){
ex.printStackTrace();
}
finally{
if(fis != null){
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
%>
</body>
</html>
这个怎么解决呀