summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-07-03 18:07:44 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-07-03 18:08:16 +0200
commit6361e7d1b794113c8b5869a76b6936daa47b0a06 (patch)
treedc72f6bdc601d4df689cc3fc5b6604d6acd73338 /src
parente3e8fe494d71a0ab1869fd4fcd275366373b464d (diff)
Fix for issue #247 : loading SVG image with BOM.
Diffstat (limited to 'src')
-rw-r--r--src/fl_images_core.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/fl_images_core.cxx b/src/fl_images_core.cxx
index e5487d356..260e9281c 100644
--- a/src/fl_images_core.cxx
+++ b/src/fl_images_core.cxx
@@ -138,6 +138,12 @@ fl_check_images(const char *name, // I - Filename
}
} // gzip'ed data
# endif // HAVE_LIBZ
+ // check for presence of Byte Order Mark (BOM)
+ char utf8[4];
+ int lutf8 = fl_utf8encode(0xFEFF /* BOM in Unicode */, utf8);
+ if (memcmp(buf, utf8, lutf8) == 0) {
+ buf += lutf8; count -= lutf8;
+ }
if ((count >= 5 && memcmp(buf, "<?xml", 5) == 0) ||
(count >= 4 && memcmp(buf, "<svg", 4) == 0))