diff --git a/core/src/main/scala/com/lightbend/paradox/ParadoxProcessor.scala b/core/src/main/scala/com/lightbend/paradox/ParadoxProcessor.scala index b5189a17..259c965c 100644 --- a/core/src/main/scala/com/lightbend/paradox/ParadoxProcessor.scala +++ b/core/src/main/scala/com/lightbend/paradox/ParadoxProcessor.scala @@ -20,6 +20,7 @@ import com.lightbend.paradox.template.PageTemplate import com.lightbend.paradox.markdown._ import com.lightbend.paradox.tree.Tree.{ Forest, Location } import java.io.{ File, FileOutputStream, OutputStreamWriter } +import java.nio.charset.StandardCharsets import java.util import org.pegdown.ast._ @@ -79,7 +80,7 @@ class ParadoxProcessor(reader: Reader = new Reader, writer: Writer = new Writer) private def createMetadata(outputDirectory: File, properties: Map[String, String]): (File, String) = { val metadataFilename = "paradox.json" val target = new File(outputDirectory, metadataFilename) - val osWriter = new OutputStreamWriter(new FileOutputStream(target)) + val osWriter = new OutputStreamWriter(new FileOutputStream(target), StandardCharsets.UTF_8) osWriter.write( s"""{ | "name" : "${properties("project.name")}", diff --git a/core/src/main/scala/com/lightbend/paradox/template/PageTemplate.scala b/core/src/main/scala/com/lightbend/paradox/template/PageTemplate.scala index fe864824..5e881168 100644 --- a/core/src/main/scala/com/lightbend/paradox/template/PageTemplate.scala +++ b/core/src/main/scala/com/lightbend/paradox/template/PageTemplate.scala @@ -17,9 +17,12 @@ package com.lightbend.paradox.template import java.io.{ File, OutputStreamWriter, FileOutputStream } +import java.nio.charset.StandardCharsets import java.util.{ Map => JMap } + import org.stringtemplate.v4.misc.STMessage import org.stringtemplate.v4.{ STErrorListener, STRawGroupDir, ST, NoIndentWriter } + import collection.concurrent.TrieMap /** @@ -40,7 +43,7 @@ class PageTemplate(directory: File, val defaultName: String = "page", startDelim t.add("page", contents) case None => sys.error(s"StringTemplate '$name' was not found for '$target'. Create a template or set a theme that contains one.") } - val osWriter = new OutputStreamWriter(new FileOutputStream(target)) + val osWriter = new OutputStreamWriter(new FileOutputStream(target), StandardCharsets.UTF_8) val noIndentWriter = new NoIndentWriter(osWriter) template.write(noIndentWriter) // does not take into account the errorListener any more... osWriter.close