[XML-SIG] encoding problem with DOM Writing
kevin Thackray
kevin.thackray at clarisys.fr
Fri May 7 10:31:40 EDT 2004
hi everyone,
I finally figure out my problem : Through a lot of google's, i came
across a PrettyPrint bug : the encoding is hard writen to utf-8, so my
iso-8895-1 encoding was ignored.
>
> Then i add somes nodes, and when i want to print that out with
> PrettyPrint, it raise this error :
> (PrettyPrint(newDoc, encoding="iso-8859-1"))
>
> UnicodeDecodeError: 'utf8' codec can't decode bytes in position 37-38:
> unexpected end of data
>
I patch it my self in the : /usr/lib/python2.3/xml/dom/ext/Printer.py
def utf8_to_code(text, encoding):
encoder = codecs.lookup(encoding)[0] # encode,decode,reader,writer
if type(text) is not UnicodeType:
#text = unicode(text, "utf-8")
text = unicode(text, encoding)
And everything work perfectly.
I just wonder why, this bug which i found some traces in a mail of 2001,
was still in my python standard distribution : Python 2.3.1 (#1, Sep 24
2003, 16:45:45) installed on a slackware, with slackware packaging :
/var/log/packages/python-2.3.1-i486-1
/var/log/packages/python-demo-2.3.1-noarch-1
/var/log/packages/python-tools-2.3.1-noarch-1
Best Regards,
Kevin Thackray
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kevin.thackray.vcf
Type: text/x-vcard
Size: 70 bytes
Desc: not available
Url : http://mail.python.org/pipermail/xml-sig/attachments/20040507/d1f80c84/kevin.thackray.vcf
More information about the XML-SIG
mailing list