diff --git a/lib/docx/office-xml-reader.js b/lib/docx/office-xml-reader.js index 861b11e1..b4e21e52 100644 --- a/lib/docx/office-xml-reader.js +++ b/lib/docx/office-xml-reader.js @@ -22,11 +22,14 @@ function read(xmlString) { function readXmlFromZipFile(docxFile, path) { if (docxFile.exists(path)) { return docxFile.read(path, "utf-8") - .then(function (xmlString) { - return xmlString.replace(/^\uFEFF/g, ''); - }) + .then(stripUtf8Bom) .then(read); } else { return promises.resolve(null); } } + + +function stripUtf8Bom(xmlString) { + return xmlString.replace(/^\uFEFF/g, ''); +}