mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-14 06:57:35 +08:00
parse xml using the encoding declared in xml header
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/html/charset"
|
||||
|
||||
"github.com/mayswind/ezbookkeeping/pkg/core"
|
||||
"github.com/mayswind/ezbookkeeping/pkg/errs"
|
||||
"github.com/mayswind/ezbookkeeping/pkg/log"
|
||||
@@ -128,7 +130,7 @@ func (e *NationalBankOfPolandDataSource) Parse(c core.Context, content []byte) (
|
||||
nationalBankOfPolandData := &NationalBankOfPolandExchangeRateData{}
|
||||
|
||||
xmlDecoder := xml.NewDecoder(bytes.NewReader(content))
|
||||
xmlDecoder.CharsetReader = utils.IdentReader
|
||||
xmlDecoder.CharsetReader = charset.NewReaderLabel
|
||||
err := xmlDecoder.Decode(&nationalBankOfPolandData)
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user