Skip to content

Commit

Permalink
fix HTML wrapping for bytes strings in Py3
Browse files Browse the repository at this point in the history
  • Loading branch information
scoder committed Mar 16, 2014
1 parent 98a170c commit 259a743
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lxml/html/__init__.py
Expand Up @@ -620,7 +620,9 @@ def fragments_fromstring(html, no_leading_text=False, base_url=None,
# FIXME: check what happens when you give html with a body, head, etc.
if isinstance(html, bytes):
if not _looks_like_full_html_bytes(html):
html = '<html><body>%s</body></html>'.encode('ascii') % html
# can't use %-formatting in early Py3 versions
html = ('<html><body>'.encode('ascii') + html +
'</body></html>'.encode('ascii'))
else:
if not _looks_like_full_html_unicode(html):
html = '<html><body>%s</body></html>' % html
Expand Down

0 comments on commit 259a743

Please sign in to comment.