mercurial/encoding.py
changeset 31448 6419cd243017
parent 31447 067add650129
child 31774 7d2cbe11ae48
--- a/mercurial/encoding.py	Mon Mar 13 09:11:08 2017 -0700
+++ b/mercurial/encoding.py	Mon Mar 13 09:12:56 2017 -0700
@@ -204,6 +204,16 @@
     """Convert a byte string of local encoding to a unicode string"""
     return fromlocal(s).decode('utf-8')
 
+# converter functions between native str and byte string. use these if the
+# character encoding is not aware (e.g. exception message) or is known to
+# be locale dependent (e.g. date formatting.)
+if pycompat.ispy3:
+    strtolocal = unitolocal
+    strfromlocal = unifromlocal
+else:
+    strtolocal = str
+    strfromlocal = str
+
 if not _nativeenviron:
     # now encoding and helper functions are available, recreate the environ
     # dict to be exported to other modules