From c93784d72633efe534bb2822dd95f8ce3b4d68b5 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 28 Apr 2016 17:27:44 +0100 Subject: [PATCH] Update node-xml.js There might be a better way to do this, but I was having issues with xml files with different encodings (utf-8) to us-ascii. This fixes it for me --- lib/node-xml.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/node-xml.js b/lib/node-xml.js index 180a482..74c3a98 100755 --- a/lib/node-xml.js +++ b/lib/node-xml.js @@ -25,6 +25,11 @@ var XMLP = function(strXML) { strXML = SAXStrings.replace(strXML, null, null, "\r\n", "\n"); strXML = SAXStrings.replace(strXML, null, null, "\r", "\n"); + // if encoded as utf-8, the first few bytes are interpreted as a space, so remove it + if (strXML.charAt(0) == '') { + strXML = strXML.substring(1); + } + this.m_xml = strXML; this.m_iP = 0; this.m_iState = XMLP._STATE_PROLOG;