Author vstinner
Recipients Matt.Mackall, durin42, georg.brandl, gregory.p.smith, martin.panter, ncoghlan, pitrou, python-dev, r.david.murray, serhiy.storchaka, vstinner
Date 2016-03-15.11:46:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1458042383.77.0.419222988564.issue24230@psf.upfronthosting.co.za>
In-reply-to
Content
"""
Today we're doing something like this:

tmpdir = tempfile.mkdtemp('', 'hgtests.', d and d.decode('utf-8')).encode('utf-8')
"""

Don't do that. UTF-8 is not the right encoding.

Use os.fsencode() and os.fsdecode(). Internally, Python uses sys.getfilesystemencoding() with 'surrogateescape' error handler (but 'strict' error handler on Windows).

If you use UTF-8, you can get indirectly mojibake.
History
Date User Action Args
2016-03-15 11:46:23vstinnersetrecipients: + vstinner, georg.brandl, gregory.p.smith, ncoghlan, pitrou, durin42, r.david.murray, python-dev, martin.panter, Matt.Mackall, serhiy.storchaka
2016-03-15 11:46:23vstinnersetmessageid: <1458042383.77.0.419222988564.issue24230@psf.upfronthosting.co.za>
2016-03-15 11:46:23vstinnerlinkissue24230 messages
2016-03-15 11:46:23vstinnercreate