Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/go-i18n.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Snyder <nickdsnyder@gmail.com>2020-09-29 07:10:47 +0300
committerNick Snyder <nickdsnyder@gmail.com>2020-09-29 07:10:47 +0300
commitb5d18987dcd811aa0cd6b15c62370109b377ec6f (patch)
treedbf8938daf293e99f2781e69c44ff2171dc3ed5c
parentba619d4d6908185c2e66904c74646d33a52517e9 (diff)
fix testhtmlentities
-rw-r--r--v2/goi18n/marshal.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/v2/goi18n/marshal.go b/v2/goi18n/marshal.go
index 751b698..a6cc762 100644
--- a/v2/goi18n/marshal.go
+++ b/v2/goi18n/marshal.go
@@ -49,7 +49,12 @@ func marshalValue(messageTemplates map[string]*i18n.MessageTemplate, sourceLangu
func marshal(v interface{}, format string) ([]byte, error) {
switch format {
case "json":
- return json.MarshalIndent(v, "", " ")
+ var buf bytes.Buffer
+ enc := json.NewEncoder(&buf)
+ enc.SetEscapeHTML(false)
+ enc.SetIndent("", " ")
+ err := enc.Encode(v)
+ return buf.Bytes(), err
case "toml":
var buf bytes.Buffer
enc := toml.NewEncoder(&buf)