##// END OF EJS Templates
typing: restore `encoding.encoding` and `encoding.encodingmode` to bytes...
Matt Harbison -
r52566:f70f61a8 default
parent child Browse files
Show More
@@ -103,14 +103,15 else:
103 if pycompat.iswindows:
103 if pycompat.iswindows:
104 _encodingrewrites[b'cp65001'] = b'utf-8'
104 _encodingrewrites[b'cp65001'] = b'utf-8'
105
105
106 encoding: bytes = b'' # help pytype avoid seeing None value
106 try:
107 try:
107 encoding = environ.get(b"HGENCODING")
108 encoding = environ.get(b"HGENCODING", b'')
108 if not encoding:
109 if not encoding:
109 encoding = locale.getpreferredencoding().encode('ascii') or b'ascii'
110 encoding = locale.getpreferredencoding().encode('ascii') or b'ascii'
110 encoding = _encodingrewrites.get(encoding, encoding)
111 encoding = _encodingrewrites.get(encoding, encoding)
111 except locale.Error:
112 except locale.Error:
112 encoding = b'ascii'
113 encoding = b'ascii'
113 encodingmode = environ.get(b"HGENCODINGMODE", b"strict")
114 encodingmode: bytes = environ.get(b"HGENCODINGMODE", b"strict")
114 fallbackencoding = b'ISO-8859-1'
115 fallbackencoding = b'ISO-8859-1'
115
116
116
117
General Comments 0
You need to be logged in to leave comments. Login now