[PATCH] py3: add an os.fsencode backport to ease path handling

Martijn Pieters mj at zopatista.com
Mon Oct 10 06:48:32 EDT 2016


On 9 October 2016 at 22:51, Yuya Nishihara <yuya at tcha.org> wrote:
>
> It appears that 'surrogateescape' is a Python 3 thing. We have
> encoding.fromutf8b/toutf8b() which should do the same thing for 'utf-8',
> but
> I have no idea how 'surrogateescape' works for the other encodings.
>

Oh crumbs. That's true. We could also just use strict or ever not support
unicode in Python 2 *at all*; the number of unicode paths in Py2 in
mercurial should be 0 *anyway*. The function is mostly there to make it
easier to write code that works both on 2 and 3 and the encoding is only
needed in 3 really.

-- 
Martijn Pieters
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20161010/63a6910a/attachment.html>


More information about the Mercurial-devel mailing list