codecs latin1 unicode standard output file

"Martin v. Löwis" martin at v.loewis.de
Mon Dec 15 16:52:14 EST 2003


Bengt Richter wrote:

> I think the OP is thinking files [1] with # -*- coding: iso-8859-1 -*- [2]
> _do_ have an encoding, so in some way [3] should be an unambiguous character sequence,
> not just a byte sequence

The OP could easily overcome this aspect of the problem with a Unicode
literal (and in fact, he originally did convert the string literal to
a Unicode object before further processing).

This does not solve the problem, though: Writing the Unicode object to
a file still gives an encoding error, since he did not specify the
encoding of the file.

Regards,
Martin





More information about the Python-list mailing list