summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorscoder <none@none>2010-03-02 13:53:47 +0100
committerscoder <none@none>2010-03-02 13:53:47 +0100
commit9b245ba9d962e1bd6bf4fe2e8cb3760fc8f32711 (patch)
treec6aab9b7acde46757dbc88faa858ac5865cf818e /src
parent18b97b8a5fcca42a41ec8873928e904b382390dc (diff)
downloadpython-lxml-9b245ba9d962e1bd6bf4fe2e8cb3760fc8f32711.tar.gz
[svn r4363] r5497@lenny: sbehnel | 2010-03-02 13:32:37 +0100
support UTF-8 encoded output in 'unicode(xslt_result)' when no encoding was specified --HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/lxml/xslt.pxi7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lxml/xslt.pxi b/src/lxml/xslt.pxi
index f379fbd3..dab0b568 100644
--- a/src/lxml/xslt.pxi
+++ b/src/lxml/xslt.pxi
@@ -707,10 +707,11 @@ cdef class _XSLTResultTree(_ElementTree):
if s is NULL:
return u''
encoding = self._xslt._c_style.encoding
- if encoding is NULL:
- encoding = 'ascii'
try:
- result = python.PyUnicode_Decode(s, l, encoding, 'strict')
+ if encoding is NULL:
+ result = s[:l].decode('UTF-8')
+ else:
+ result = python.PyUnicode_Decode(s, l, encoding, 'strict')
finally:
tree.xmlFree(s)
return _stripEncodingDeclaration(result)