From 2b46f5a6d33f81d80bb52f1ef48b6ad8b381fa76 Mon Sep 17 00:00:00 2001
From: Martin Nilsson <nilsson@fastmail.com>
Date: Thu, 8 Dec 2016 20:09:58 +0100
Subject: [PATCH] Bugfix decoding of UTF-8 encoded BOM.

---
 src/modules/Parser/xml.cmod | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/modules/Parser/xml.cmod b/src/modules/Parser/xml.cmod
index d6178cb0f5..9dbba9e55b 100644
--- a/src/modules/Parser/xml.cmod
+++ b/src/modules/Parser/xml.cmod
@@ -3310,7 +3310,7 @@ PIKEFUN string autoconvert(string s)
 	return;
 
       case 0xefbb: /* UTF-8 */
-	if (STR0(s)[3] != 0xbf) break;
+        if (STR0(s)[2] != 0xbf) break;
 	IF_XMLDEBUG(fprintf(stderr, "UTF-8 detected.\n"));
 	push_int(3);
 	push_int(0x7fffffff);
-- 
GitLab