UnicodeError for join()

tmallen thomasmallen at gmail.com
Thu Jan 15 22:00:50 CET 2009


On Jan 15, 3:34 pm, "Martin v. Löwis" <mar... at v.loewis.de> wrote:
> > rc_file.write("\n\n".join([self.title, "### BEGIN CONTENT ###",
> > self.content]))
> > .................
> > UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position
> > 442: ordinal not in range()
>
> > What should I change to make this unicode-safe?
>
> One of self.title and self.content is a Unicode string, the other is
> a byte string. You need to change them to have the same type (depending
> on whether you want to process them as Unicode or byte strings).
>
> HTH,
> Martin

How can I do that?

Thomas



More information about the Python-list mailing list