Author vstinner
Recipients arjennienhuis, barry, benjamin.peterson, christian.heimes, durin42, ecir.hana, eric.smith, exarkun, ezio.melotti, flox, glyph, gregory.p.smith, gvanrossum, loewis, martin.panter, nlevitt@gmail.com, pitrou, serhiy.storchaka, stendec, terry.reedy, uau, vstinner
Date 2013-10-08.21:24:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAMpsgwbtgb55UWd=4NPa8dLSFn0Q8sM1zvmjwWZ+2tWe7dopTQ@mail.gmail.com>
In-reply-to <CAPLqtWLq3YeguQsj2nKtdvWiAc2bURkG6Sj=67-ag9b4DEuvCg@mail.gmail.com>
Content
2013/10/8 Augie Fackler <report@bugs.python.org>:
> sys.stdout.write('%(state)s %(path)s\n' % {'state': 'M', 'path':
> 'some/filesystem/path'})
>
> except we don't know the encoding of the filesystem path (Hi unix!) so we
> have to treat the whole thing as opaque bytes.

You are doing it wrong. In Python 3, you "should" store filenames as
Unicode (str type). If Python fails to decode a filename, undecodable
bytes are stored as surrogate characters (see the PEP 383).

The Unicode type became natural in Python 3, as byte string (old "str"
type) was natural in Python 2.

sys.stdout.write() expects a Unicode string, not a byte string.

Does it mean that Mercurial is moving to Python 3? Cool :-)
History
Date User Action Args
2013-10-08 21:24:53vstinnersetrecipients: + vstinner, gvanrossum, loewis, barry, terry.reedy, gregory.p.smith, exarkun, pitrou, eric.smith, christian.heimes, benjamin.peterson, glyph, ezio.melotti, durin42, arjennienhuis, flox, ecir.hana, uau, martin.panter, serhiy.storchaka, nlevitt@gmail.com, stendec
2013-10-08 21:24:53vstinnerlinkissue3982 messages
2013-10-08 21:24:53vstinnercreate