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 @@ -1002,7 +1002,7 @@ def _open_file_or_url(fname):
1002
1002
f .close ()
1003
1003
else :
1004
1004
fname = os .path .expanduser (fname )
1005
- encoding = locale .getdefaultlocale ()[ 1 ]
1005
+ encoding = locale .getpreferredencoding ( do_setlocale = False )
1006
1006
if encoding is None :
1007
1007
encoding = "utf-8"
1008
1008
with io .open (fname , encoding = encoding ) as f :
@@ -1043,7 +1043,8 @@ def _rc_params_in_file(fname, fail_on_error=False):
1043
1043
warnings .warn (
1044
1044
('Cannot decode configuration file %s with '
1045
1045
'encoding %s, check LANG and LC_* variables' )
1046
- % (fname , locale .getdefaultlocale ()[1 ] or 'utf-8 (default)' ))
1046
+ % (fname , locale .getpreferredencoding (do_setlocale = False ) or
1047
+ 'utf-8 (default)' ))
1047
1048
raise
1048
1049
1049
1050
config = RcParams ()
You can’t perform that action at this time.
0 commit comments