5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-29 13:11:36 +00:00

Merge pull request #135 from neilalexander/utf16

Fix typo for big-endian BOM
This commit is contained in:
Neil Alexander 2018-06-16 17:05:43 +01:00 committed by GitHub
commit 0ca2cda49b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,7 +117,7 @@ func main() {
// of it - remove it and decode back down into UTF-8. This is necessary // of it - remove it and decode back down into UTF-8. This is necessary
// because hjson doesn't know what to do with UTF-16 and will panic // because hjson doesn't know what to do with UTF-16 and will panic
if bytes.Compare(config[0:2], []byte{0xFF, 0xFE}) == 0 || if bytes.Compare(config[0:2], []byte{0xFF, 0xFE}) == 0 ||
bytes.Compare(config[0:2], []byte{0xFF, 0xFF}) == 0 { bytes.Compare(config[0:2], []byte{0xFE, 0xFF}) == 0 {
utf := unicode.UTF16(unicode.BigEndian, unicode.UseBOM) utf := unicode.UTF16(unicode.BigEndian, unicode.UseBOM)
decoder := utf.NewDecoder() decoder := utf.NewDecoder()
config, err = decoder.Bytes(config) config, err = decoder.Bytes(config)