summaryrefslogtreecommitdiffstats
path: root/pyload/lib/simplejson/decoder.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/lib/simplejson/decoder.py')
-rw-r--r--pyload/lib/simplejson/decoder.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/pyload/lib/simplejson/decoder.py b/pyload/lib/simplejson/decoder.py
index 1a6c5d938..545e65877 100644
--- a/pyload/lib/simplejson/decoder.py
+++ b/pyload/lib/simplejson/decoder.py
@@ -390,4 +390,11 @@ class JSONDecoder(object):
raise JSONDecodeError('Expecting value', s, idx)
if _PY3 and not isinstance(s, text_type):
raise TypeError("Input string must be text, not bytes")
+ # strip UTF-8 bom
+ if len(s) > idx:
+ ord0 = ord(s[idx])
+ if ord0 == 0xfeff:
+ idx += 1
+ elif ord0 == 0xef and s[idx:idx + 3] == '\xef\xbb\xbf':
+ idx += 3
return self.scan_once(s, idx=_w(s, idx).end())