Configuration cfg = new Configuration(); cfg.setDefaultEncoding("UTF-8"); ...... Template template = cfg.getTemplate(templateFileName); template.setEncoding("UTF-8"); creatDirs(buildPath.getFilename(),htmlFilePath); File htmlFile = new File(buildPath + htmlFilePath + htmlFileName); Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(htmlFile),"UTF-8")); template.process(propMap,out); out.flush();
评论