在读取时,用 BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
@Override public void doTag() throws JspException, IOException { PageContext pageContext = (PageContext)getJspContext(); InputStream in = pageContext.getServletContext().getResourceAsStream(src); BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); String str = null; while((str = reader.readLine()) != null){ str = Pattern.compile("<").matcher(str).replaceAll("<"); str = Pattern.compile(">").matcher(str).replaceAll("&rt"); //str = new String(str.getBytes("ISO-8859-1"),"UTF-8"); pageContext.getOut().println(str); pageContext.getOut().println("<br>"); } }