Leonidas-from-XIV / node-xml2js

XML to JavaScript object converter.
MIT License
4.88k stars 602 forks source link

Error: Invalid character in string:  at index 0 #547

Open Christilut opened 4 years ago

Christilut commented 4 years ago

I have a control character in my XML and the builder seems to error on it.

The character is just a value in an attribute, the XML is otherwise valid.

In my case it is this character:  which is ASCII character 5 "Enquiry".

Should the builder not remove these? All control characters except LF and CR aren't really wanted in text content.

leafac commented 4 years ago

I’m having the same issue and I’d like the same solution: just get rid of invalid characters. I’m talking to the author of the library on which this one is based over here: https://github.com/oozcitak/xmlbuilder-js/issues/147#issuecomment-604031768

leafac commented 4 years ago

The author of xmlbuilder included a new option called invalidCharReplacement to address this issue. It’s in the version 15.1.0 of the xmlbuilder package. Unfortunately, we can’t use it yet because xml2js require version 11.

@Leonidas-from-XIV, would you be okay with updating xmlbuilder?

Christilut commented 4 years ago

@Leonidas-from-XIV Would love support for this! Getting bitten by this problem very often

PAHJunior commented 3 years ago

when will this update for xml2js come out?

abou7mied commented 1 year ago

Any update on this? (updating xmlbuilder to the newer version)