We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在文件写入时设置编码为UTF-8即可
public static void dynamicGenerator(String inputPath,String outputPath,String templateName,String GeneratorFileName,Object Model) throws IOException, TemplateException { Configuration cfg = new Configuration(Configuration.VERSION_2_3_31); cfg.setDirectoryForTemplateLoading(new File(inputPath)); cfg.setDefaultEncoding("UTF-8"); //获取到对应的模板 Template template = cfg.getTemplate(templateName); //指定模板引擎生成的文件路径 FileOutputStream fileOutputStream = new FileOutputStream(outputPath+File.separator+GeneratorFileName); Writer output = new OutputStreamWriter(fileOutputStream,StandardCharsets.UTF_8); template.process(Model,output); output.close(); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
在文件写入时设置编码为UTF-8即可
The text was updated successfully, but these errors were encountered: