We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi @beevik After I done some tests I got same error presented in issue #48 Here is a sample of code + xml data :
var xmlDoc = `<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE broadWorksCDR> <broadWorksCDR version="19.0"> <cdrData> <headerModule> <recordId> <eventCounter>0002183384</eventCounter> <systemId>CGRateSaabb</systemId> <date>20160419210000.104</date> <systemTimeZone>1+020000</systemTimeZone> </recordId> <type>Start</type> </headerModule> </cdrData> </broadWorksCDR> ` doc := etree.NewDocument() if err := doc.ReadFromBytes([]byte(xmlDoc)); err != nil { t.Error(err) }
First I try to use doc.ReadFromString after doc.ReadFromBytes but got error both times.
Thanks, TeoV
The text was updated successfully, but these errors were encountered:
Hi again @beevik I found that
doc.ReadSettings.CharsetReader = func(label string, input io.Reader) (io.Reader, error) { return input, nil }
Resolve the problem. I will let the issue open in case you have another idea.
Sorry, something went wrong.
I'll try to take a look at this when I get a chance. Thanks for the report, @TeoV.
Hi,
Reading the go source code, this seems to be the normal behavior of the default decoder (in xml.go):
if enc != "" && enc != "utf-8" && enc != "UTF-8" && !strings.EqualFold(enc, "utf-8") { if d.CharsetReader == nil { d.err = fmt.Errorf("xml: encoding %q declared but Decoder.CharsetReader is nil", enc) return nil, d.err } [...]
Gabriel
This is now fixed in dd07e7c
No branches or pull requests
Hi @beevik
After I done some tests I got same error presented in issue #48
Here is a sample of code + xml data :
First I try to use doc.ReadFromString after doc.ReadFromBytes but got error both times.
Thanks,
TeoV
The text was updated successfully, but these errors were encountered: