<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head><style>p {margin:0px;padding:0px;} blockquote { border: 0px; margin-top: 0px; margin-bottom: 0px; }</style></head><body style="">
Hi Stefan,<br><font color="#000000" face="Verdana" size="2"><br></font><blockquote type="cite"><font color="#000000" face="Verdana" size="2">It would also require a bit more parameter checking and exception raising. The<br>unicode option and the encoding are mutually exclusive, and unicode is not so<br>far from an encoding that it would really merit an option on its own.<br><br>Note also that you do not pass "Unicode" as a string but the unicode type, and<br>you get a unicode object back.<br><br></font><p></p><p></p></blockquote><p> </p><p> </p><p>I took the liberty to modify the documentation a tiny little bit to reward this behaviour:</p><p> </p><p>$ svn diff -rPREV doc/parsing.txt<br>Index: doc/parsing.txt<br>===================================================================<br>--- doc/parsing.txt (revision 56229)<br>+++ doc/parsing.txt (working copy)<br>@@ -675,8 +675,8 @@<br> >>> etree.tostring(root, encoding='UTF-8', xml_declaration=False)<br> b'<test> \xef\xa3\x91 + \xef\xa3\x92 </test>'<br> <br>-As an extension, lxml.etree recognises the unicode type as encoding to<br>-build a Python unicode representation of a tree:<br>+As an extension, lxml.etree recognises the unicode type as an argument to the<br>+encoding parameter to build a Python unicode representation of a tree:<br> <br> .. sourcecode:: pycon </p><p> </p><p>I think this subtly documents that unicode is not an encoding, strictly speaking.</p><p> </p><p>Holger </p><p></p><font></font><p></p><div class="signature"><br /><br /><br />-- <br />Psssst! Schon vom neuen GMX MultiMessenger gehört?<br />Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger</div></body></html>