# HG changeset patch # User Augie Fackler # Date 1489901890 14400 # Node ID 713e984bec91bdd0429483fab352667cbed99ba4 # Parent 326bca5477d0d787614c54f58b45d6ecefbcc59c ui: convert to/from Unicode on Python 3 in ui.editor() I considered making this I/O be done in terms of bytes, but that would cause an observable regression for Windows users, as non-binary-mode open does EOL conversion there. There are probably new encoding dragons lurking here, so we may want to switch to using binary mode and doing EOL conversion ourselves. diff -r 326bca5477d0 -r 713e984bec91 mercurial/ui.py --- a/mercurial/ui.py Sun Mar 19 01:12:03 2017 -0400 +++ b/mercurial/ui.py Sun Mar 19 01:38:10 2017 -0400 @@ -1196,7 +1196,7 @@ dir=rdir) try: f = os.fdopen(fd, pycompat.sysstr("w")) - f.write(text) + f.write(encoding.strfromlocal(text)) f.close() environ = {'HGUSER': user} @@ -1219,7 +1219,7 @@ blockedtag='editor') f = open(name) - t = f.read() + t = encoding.strtolocal(f.read()) f.close() finally: os.unlink(name)