node-xml2js icon indicating copy to clipboard operation
node-xml2js copied to clipboard

Error: Invalid character in string:  at index 0

Open Christilut opened this issue 5 years ago • 5 comments

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.

Christilut avatar Dec 25 '19 15:12 Christilut

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 avatar Mar 25 '20 19:03 leafac

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?

leafac avatar Mar 27 '20 19:03 leafac

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

Christilut avatar Apr 26 '20 06:04 Christilut

when will this update for xml2js come out?

PAHJunior avatar Nov 04 '20 17:11 PAHJunior

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

abou7mied avatar Jun 02 '23 14:06 abou7mied