Python's 8-bit cleanness deprecated?
Jeff Epler
jepler at unpythonic.net
Sun Feb 9 13:46:53 EST 2003
Roman,
we're sorry there's such a minefield of different encodings. But what
happens if you write something koi8-r, and somebody using cp1251 downloads
it? Without an encoding cookie, he'll get gibberish when he runs the
program, since all non-ASCII strings will be in the wrong encoding.
With an encoding cookie, he'll get the right thing.
I don't know what to suggest for printed code listings. The GUI editor
that people use should simply insert # -*- coding: xxx -*- automatically,
using the right 'xxx' value. (we're talking about idiots here, so it'll
have to be done automatically) And in your listing, you could just print
# -*- encoding: /see text/ -*-
with // denoting italics or something that is obviously not simple program
text.
"Your" way, of trying to assume the contents of a file with high bits set,
means that the common way of exchanging Python programs (as electronic
files) won't work, but an uncommon way seems to present a small problem
that you'd be forced to explain.
Jeff
More information about the Python-list
mailing list