1
0
mirror of https://github.com/TomWright/dasel.git synced 2022-05-22 02:32:45 +03:00

add support for other charsets

This commit is contained in:
Breno Loyola
2021-09-23 12:59:00 -03:00
parent bd465f7f77
commit 448236a7b5
3 changed files with 10 additions and 1 deletions

1
go.mod
View File

@@ -14,5 +14,6 @@ require (
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect
github.com/dlclark/regexp2 v1.4.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/paulrosania/go-charset v0.0.0-20190326053356-55c9d7a5834c // indirect
github.com/spf13/pflag v1.0.5 // indirect
)

2
go.sum
View File

@@ -206,6 +206,8 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/paulrosania/go-charset v0.0.0-20190326053356-55c9d7a5834c h1:P6XGcuPTigoHf4TSu+3D/7QOQ1MbL6alNwrGhcW7sKw=
github.com/paulrosania/go-charset v0.0.0-20190326053356-55c9d7a5834c/go.mod h1:YnNlZP7l4MhyGQ4CBRwv6ohZTPrUJJZtEv4ZgADkbs4=
github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ=
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=

View File

@@ -3,14 +3,20 @@ package storage
import (
"bytes"
"fmt"
"github.com/clbanning/mxj/v2"
"strings"
"github.com/clbanning/mxj/v2"
"github.com/paulrosania/go-charset/charset"
_ "github.com/paulrosania/go-charset/data"
)
func init() {
// Required for https://github.com/TomWright/dasel/issues/61
mxj.XMLEscapeCharsDecoder(true)
// Required for https://github.com/TomWright/dasel/issues/164
mxj.XmlCharsetReader = charset.NewReader
registerReadParser([]string{"xml"}, []string{".xml"}, &XMLParser{})
registerWriteParser([]string{"xml"}, []string{".xml"}, &XMLParser{})
}