急!文件上传乱码的奇怪问题
直接上代码,如下:
/** * 下面的这几行代码是在struts2的Action中 * request返回字符集是UTF-8 * 文件也创建成功 * newFile定义为html文件类型 */File newFile = new File(subFilePath + File.separator + this.getFileName(subFile) + ".html");System.out.println("字符集-------->"+request.getCharacterEncoding());System.out.println(context); //这里也可以正常显示中文newFile.createNewFile(); osw.write(context);osw.close();logger.info("新建文件成功");