From 5b73f43ce95778ab4590d7d14f22d47a2e07c60f Mon Sep 17 00:00:00 2001 From: Joseph Humfrey Date: Mon, 30 Apr 2018 10:12:56 +0100 Subject: [PATCH] Strip BOM on load --- app/renderer/inkFile.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/renderer/inkFile.js b/app/renderer/inkFile.js index f4e24469..e5095fc6 100644 --- a/app/renderer/inkFile.js +++ b/app/renderer/inkFile.js @@ -227,6 +227,10 @@ InkFile.prototype.tryLoadFromDisk = function(loadCallback) { return; } + // Strip any BOM + // https://en.wikipedia.org/wiki/Byte_order_mark + data = data.replace(/^\uFEFF/, ''); + // Success - fire this callback before other callbacks // like document change get fired loadCallback(true);