[Tutor] Unicode Encode Error
Kent Johnson
kent37 at tds.net
Thu Apr 27 21:24:34 CEST 2006
Danny Yoo wrote:
>> You're right, I realised after playing with Tim's example that the
>> problem was that I wasn't calling close() on the codecs file. Adding
>> this after the f.write(html_text) seems to flush the buffer which means
>> that the content now gets written to the file.
>
> Hi Frank,
>
> Quick note: it may be important to write and read from the file using
> binary mode "b". It's not so significant under Unix, but it is more
> significant under Windows, because otherwise we may get some weird
> results.
But the file is utf-8 text, ISTM it should be written as text, not
binary. Why do you recommend binaray mode?
Kent
More information about the Tutor
mailing list