summaryrefslogtreecommitdiff
path: root/bs4/builder/_lxml.py
diff options
context:
space:
mode:
Diffstat (limited to 'bs4/builder/_lxml.py')
-rw-r--r--bs4/builder/_lxml.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/bs4/builder/_lxml.py b/bs4/builder/_lxml.py
index 11c9a69..1334f94 100644
--- a/bs4/builder/_lxml.py
+++ b/bs4/builder/_lxml.py
@@ -172,6 +172,12 @@ class LXMLTreeBuilderForXML(TreeBuilder):
if isinstance(markup, str):
# We were given Unicode. Maybe lxml can parse Unicode on
# this system?
+
+ # TODO: This is a workaround for
+ # https://bugs.launchpad.net/lxml/+bug/1948551.
+ # We can remove it once the upstream issue is fixed.
+ if len(markup) > 0 and markup[0] == u'\N{BYTE ORDER MARK}':
+ markup = markup[1:]
yield markup, None, document_declared_encoding, False
if isinstance(markup, str):