node.js and xmlbuilder – error on invalid characters or emoticons

Xml builder has problem with emoticons or “invalid” characters (e.g. x\ u\ e.g. u\0007 – Bell or another characters mentioned by xml specifications). If You don’t apply xml parser to detect invalid characters then instance of node.js server can be crushed. During parsing you will have got error like following [“uncaughtException::catchError Error: Invalid character (\u0007) in string: Remember about meeting \u0007/1 at index 36”].

With problem related with invalid characters You can have chance to touch it in case of text-rich editors, when You try convert plain-text to xml.

For avoid this problems we have two very simple solutions:

emoticons: You have to place in create function of xmlbuilder parameter like on below screen

invalid characters (let’s say not acceptable by xml standard) – to solve this issue please use defined by me function which works on regex

The whole source code is following on production environment

April 27th, 2017

Leave a Reply

Your email address will not be published. Required fields are marked *