Skip to content

Commit bcd8d24

Browse files
committed
win, gitpython-developers#519: Change default-encoding to locale.getpreferredencoding()
+ On Windows, this is the default encoding (usually, the mate-encoding `mcbs' which points to the current code-page (i.e. `cp1252` for Europe).
1 parent 32d12c8 commit bcd8d24

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

git/compat.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#
55
# This module is part of GitPython and is released under
66
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
7+
import locale
78
"""utilities to help provide compatibility with python 3"""
89
# flake8: noqa
910

@@ -28,7 +29,7 @@
2829
is_win = (os.name == 'nt')
2930
is_posix = (os.name == 'posix')
3031
is_darwin = (os.name == 'darwin')
31-
defenc = sys.getdefaultencoding()
32+
defenc = locale.getpreferredencoding(False) if is_win else sys.getdefaultencoding()
3233

3334
if PY3:
3435
import io

0 commit comments

Comments
 (0)