changeset 30622:ce36fa9b140c

py3: make sure encoding.encoding is a bytes variable encoding.encoding returns unicodes when locale.getpreferredencoding() is used to get the preferred encoding. This patch fixes that.
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 17 Dec 2016 23:55:25 +0530
parents d7875bfbfccb
children c6026c20a3ce
files mercurial/encoding.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/encoding.py	Mon Dec 19 22:15:00 2016 +0000
+++ b/mercurial/encoding.py	Sat Dec 17 23:55:25 2016 +0530
@@ -93,7 +93,7 @@
 try:
     encoding = environ.get("HGENCODING")
     if not encoding:
-        encoding = locale.getpreferredencoding() or 'ascii'
+        encoding = locale.getpreferredencoding().encode('ascii') or 'ascii'
         encoding = _encodingfixers.get(encoding, lambda: encoding)()
 except locale.Error:
     encoding = 'ascii'