diff -r 9a94239e4f12 -r 067add650129 mercurial/encoding.py --- a/mercurial/encoding.py Mon Mar 13 08:53:31 2017 -0700 +++ b/mercurial/encoding.py Mon Mar 13 09:11:08 2017 -0700 @@ -196,6 +196,14 @@ except LookupError as k: raise error.Abort(k, hint="please check your locale settings") +def unitolocal(u): + """Convert a unicode string to a byte string of local encoding""" + return tolocal(u.encode('utf-8')) + +def unifromlocal(s): + """Convert a byte string of local encoding to a unicode string""" + return fromlocal(s).decode('utf-8') + if not _nativeenviron: # now encoding and helper functions are available, recreate the environ # dict to be exported to other modules