From 76adc351b75b2489f3ef009a7e39df3dabadb50d Mon Sep 17 00:00:00 2001 From: Chris Price Date: Mon, 18 Aug 2014 22:26:49 -0400 Subject: Remove potential Unicode BOM after reading XML file --- tests/mammoth.tests.js | 8 ++++++++ tests/test-data/bom.docx | Bin 0 -> 2836 bytes 2 files changed, 8 insertions(+) create mode 100644 tests/test-data/bom.docx (limited to 'tests') diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js index e0c1f6c..9be7006 100644 --- a/tests/mammoth.tests.js +++ b/tests/mammoth.tests.js @@ -32,6 +32,14 @@ describe('mammoth', function() { }); }); + test('should read docx xml files with unicode byte order mark', function() { + var docxPath = path.join(__dirname, "test-data/bom.docx"); + return mammoth.convertToHtml({path: docxPath}).then(function (result) { + assert.equal(result.value, "

This XML has a byte order mark.

"); + assert.deepEqual(result.messages, []); + }); + }); + test('style map can be expressed as string', function() { var docxFile = createFakeDocxFile({ "word/document.xml": testData("simple/word/document.xml") diff --git a/tests/test-data/bom.docx b/tests/test-data/bom.docx new file mode 100644 index 0000000..3881238 Binary files /dev/null and b/tests/test-data/bom.docx differ -- cgit v1.2.3