template should load with utf-8 and save with utf-8

This commit is contained in:
dev 2016-12-07 17:32:12 +09:00 committed by Dave Syer
parent e6ad78a510
commit a3a05000b0
2 changed files with 2 additions and 2 deletions

View File

@ -408,7 +408,7 @@ class ProjectGenerator {
def write(File target, String templateName, def model) { def write(File target, String templateName, def model) {
def tmpl = templateName.endsWith('.groovy') ? templateName + '.tmpl' : templateName def tmpl = templateName.endsWith('.groovy') ? templateName + '.tmpl' : templateName
def body = groovyTemplate.process tmpl, model def body = groovyTemplate.process tmpl, model
target.write(body) target.write(body, 'utf-8')
} }
private void addTempFile(String group, File file) { private void addTempFile(String group, File file) {

View File

@ -70,7 +70,7 @@ class GroovyTemplate {
def classLoader = GroovyTemplate.class.classLoader def classLoader = GroovyTemplate.class.classLoader
def resource = classLoader.getResource("templates/" + name) def resource = classLoader.getResource("templates/" + name)
if (resource) { if (resource) {
return engine.createTemplate(resource) return engine.createTemplate(resource.getText('utf-8'))
} }
return engine.createTemplate(name) return engine.createTemplate(name)