On 12/02/2012 08:26, Matej Cepl wrote:
On 12.2.2012 09:14, Matej Cepl wrote:
Obvious answers:
- Try decoding with UTF8 or Latin1. Even if you don't get the right
characters, you'll get *something*.
- Use open(filename, encoding='ascii', errors='surrogateescape')
(Or possibly errors='ignore'.)
These are not good answer, IMHO. The only answer I can think of, really,
is:
Slightly less flameish answer to the question “What should I do,
really?” is a tough one: all these suggested answers are bad because
they don’t deal with the fact, that your input data are obviously
broken. The rest is just pure GIGO … without fixing (and I mean, really,
fixing, not ignoring the problem, which is what the previous answers
suggest) your input, you’ll get garbage on output. And you should be
thankful to py3k that it shown the issue to you.
BTW, can you display the following line?
Příliš žluťoučký kůň úpěl ďábelské ódy.
Best,
Matěj
Yes in Thunderbird, Notepad, Wordpad and Notepad++ on Windows Vista,
can't be bothered to try any other apps.
--
Cheers.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list