Unicode with encoding not supported but errors in a bad way

Issue #51 resolved
Anonymous created an issue

lxml does not support unicode strings with an explicit encoding, and raises a ValueError. pyquery catches this and raises its own ValueError with a non-descriptive error message. It would be an improvement if pyquery returned a better error message in this case.

To replicate:

xml = unicode('<?xml version="1.0"?>', 'ISO-8859-1') PyQuery(xml) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "---/site-packages/pyquery/pyquery.py", line 184, in init raise ValueError(repr(context)) ValueError: u'<?xml version="1.0"?>'

See also http://lxml.de/parsing.html

Comments (1)

  1. Log in to comment