[XML-SIG] xmlproc bug ?

Juergen Hermann Juergen Hermann" <jh@web.de
Thu, 06 Sep 2001 13:39:10 +0200


On Thu, 6 Sep 2001 12:16:02 +0200 (CEST), Alexandre Fayolle wrote:

>The code you posted causes an exception because the string I get is not
>ASCII, but iso-latin-1 :

Tested it again, and indeed it fails... with Python 2.0. With 2.1, runs 
like a champ. Go figure. Possible cause is that I have PyXML 0.7 
installed in 2.1, which emits unicode strings.

This works in both (for me):

def write(x):
    s = x or ""
    if type(s) == type(u''):
        s = s.encode("ISO-8859-1")
    sys.stdout.write(s + "\n")