How do you read unicode files?

Martin v. Löwis loewis at informatik.hu-berlin.de
Fri Jun 7 11:07:35 EDT 2002


"Matt Gerrans" <mgerrans at mindspring.com> writes:

> Thanks Mike, Francis and Martin for the quick replies!
> 
> My mistake was using readlines() to read the text file, instead of read().
> (I should have posted a snippet of code in the first place and probably you
> all would have noticed that immediately).

Yes, you cannot read-and-decode UTF-16 line-by-line. Unfortunately,
the Python UTF-16 stream reader also does not support .readline, even
though it should.

Regards,
Martin




More information about the Python-list mailing list