Skip to content

Commit

Permalink
Specify UTF-8 for output (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
raboof authored Apr 1, 2019
1 parent adf2ef9 commit 2d42a39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand Down Expand Up @@ -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")}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand All @@ -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
Expand Down

0 comments on commit 2d42a39

Please sign in to comment.