From 2eb3f6600fce8d8652ac8987dd9a27de26eb57c5 Mon Sep 17 00:00:00 2001 From: Hidetake Iwata Date: Sun, 9 Dec 2018 15:27:30 +0900 Subject: [PATCH] Fix charset of generated files --- .../org/hidetake/gradle/swagger/generator/GenerateReDoc.groovy | 2 +- .../hidetake/gradle/swagger/generator/GenerateSwaggerUI.groovy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/groovy/org/hidetake/gradle/swagger/generator/GenerateReDoc.groovy b/src/main/groovy/org/hidetake/gradle/swagger/generator/GenerateReDoc.groovy index af5a2467..655efa2c 100644 --- a/src/main/groovy/org/hidetake/gradle/swagger/generator/GenerateReDoc.groovy +++ b/src/main/groovy/org/hidetake/gradle/swagger/generator/GenerateReDoc.groovy @@ -48,7 +48,7 @@ class GenerateReDoc extends DefaultTask { } outputDir.mkdirs() - new File(outputDir, 'index.html').withWriter { writer -> + new File(outputDir, 'index.html').withWriter('UTF-8') { writer -> XmlUtil.serialize(html, writer) } project.copy { diff --git a/src/main/groovy/org/hidetake/gradle/swagger/generator/GenerateSwaggerUI.groovy b/src/main/groovy/org/hidetake/gradle/swagger/generator/GenerateSwaggerUI.groovy index da0a3c88..03c5be05 100644 --- a/src/main/groovy/org/hidetake/gradle/swagger/generator/GenerateSwaggerUI.groovy +++ b/src/main/groovy/org/hidetake/gradle/swagger/generator/GenerateSwaggerUI.groovy @@ -83,7 +83,7 @@ class GenerateSwaggerUI extends DefaultTask { private void buildSwaggerSpec() { def inputJson = Mappers.YAML.readTree(inputFile) - new File(outputDir, 'swagger-spec.js').withWriter { writer -> + new File(outputDir, 'swagger-spec.js').withWriter('UTF-8') { writer -> writer.append('window.swaggerSpec=') Mappers.JSON.writeValue(writer, inputJson) }