Some questions about decode/encode

7stud bbxx789_05ss at
Thu Jan 24 17:13:16 CET 2008

On Jan 24, 1:44 am, Marc 'BlackJack' Rintsch <bj_... at> wrote:
> On Wed, 23 Jan 2008 19:49:01 -0800, glacier wrote:
> > My second question is: is there any one who has tested very long mbcs
> > decode? I tried to decode a long(20+MB) xml yesterday, which turns out
> > to be very strange and cause SAX fail to parse the decoded string.
> That's because SAX wants bytes, not a decoded string.  Don't decode it
> yourself.

encode() converts a unicode string to a regular string.  decode()
converts a regular string to a unicode string.  So I think what Marc
is saying is that SAX needs a regular string(i.e. bytes) not a decoded
string(i.e. a unicode string).

More information about the Python-list mailing list