[XML-SIG] Re: Re: UnicodeError: ASCII encoding error: ordinal notinrange(128)

Fredrik Lundh fredrik at pythonware.com
Wed Nov 26 07:35:10 EST 2003


Walter Dörwald wrote:

> > if you're using Python 2.3, you can use the "xmlcharrefreplace"
> > error handler:
> >
> >     print xmldoc.toxml().encode("ascii", "xmlcharrefreplace")
> >
> >     <?xml version="1.0" ?>
> >     <StyleBox>
> >        <String>&#63482;</String>
> >     </StyleBox>
>
> But this will escape characters even inside comments or processing
> instructions.

which may or may not be a problem, depending on the application.

</F>






More information about the XML-SIG mailing list