You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Convert from XML (string) ->> JSON;// explicitArray: true, Make sure we have an Array on all elements, else elements with value only will be none Array// explicitCharkey: true, We always want data in ._ and attributes under .$// allowSurrogateChars: true, Allow unicode characters, e.g. emojiesconstconvertUblXmlToUblJson=async(xmlString,options={explicitArray: true,explicitCharkey: true,allowSurrogateChars: true},stripPrefix=false)=>{if(stripPrefix){conststripPrefixProcessor=xml2js.processors.stripPrefix;// eslint-disable-next-line no-param-reassignoptions={
...options,
...{tagNameProcessors: [stripPrefixProcessor],attrNameProcessors: [stripPrefixProcessor]}};}constparser=newxml2js.Parser(options);returnparser.parseStringPromise(xmlString);};
allowSurrogateChars works nicely for e.g. emoji data, but I run into an error for non-breaking space in XML data... Invalid character in ...
The XML data is like:
<cbc:Name> </cbc:Name>
Where the "space" is HEX C2 0A, or unicode \u00A0, hence a non-breaking space ( in HTML).
This is valid UTF-8 obviously so why is it crashing the parser?
The text was updated successfully, but these errors were encountered:
I have the following function:
allowSurrogateChars
works nicely for e.g. emoji data, but I run into an error for non-breaking space in XML data...Invalid character in ...
The XML data is like:
Where the "space" is
HEX C2 0A
, or unicode\u00A0
, hence a non-breaking space (
in HTML).This is valid UTF-8 obviously so why is it crashing the parser?
The text was updated successfully, but these errors were encountered: