> -----Original Message----- > From: Python-Dev [mailto:python-dev- > bounces+kristjan=ccpgames....@python.org] On Behalf Of Antoine Pitrou > Sent: 9. janúar 2014 12:42 > To: python-dev@python.org > Subject: Re: [Python-Dev] Python3 "complexity" > > On Thu, 9 Jan 2014 10:15:08 +0000 > Kristján Valur Jónsson <krist...@ccpgames.com> wrote: > > > > Moving to python 3, I found that this quickly caused problems. So, I > > explicitly added an encoding. Better guess an encoding, something that is > likely, e.g. cp1252 with open(fn1, encoding='cp1252') as f1: > > with open(fn2, 'w', encoding='cp1252') as f2: > > f2.write(process_text(f1.read()) > > If you don't "care" about the encoding, why don't you use latin1? > Things will roundtrip fine and work as well as under Python 2.
Because latin1 does not define all code points, giving you errors there. Same with cp1252. Which is why you need 'surrogateescape' in addition. K _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com