File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -1003,7 +1003,7 @@ def _open_file_or_url(fname):
1003
1003
f .close ()
1004
1004
else :
1005
1005
fname = os .path .expanduser (fname )
1006
- encoding = locale .getdefaultlocale ()[ 1 ]
1006
+ encoding = locale .getpreferredencoding ( do_setlocale = False )
1007
1007
if encoding is None :
1008
1008
encoding = "utf-8"
1009
1009
with io .open (fname , encoding = encoding ) as f :
@@ -1044,7 +1044,8 @@ def _rc_params_in_file(fname, fail_on_error=False):
1044
1044
warnings .warn (
1045
1045
('Cannot decode configuration file %s with '
1046
1046
'encoding %s, check LANG and LC_* variables' )
1047
- % (fname , locale .getdefaultlocale ()[1 ] or 'utf-8 (default)' ))
1047
+ % (fname , locale .getpreferredencoding (do_setlocale = False ) or
1048
+ 'utf-8 (default)' ))
1048
1049
raise
1049
1050
1050
1051
config = RcParams ()
You can’t perform that action at this time.
0 commit comments