Skip to content
Prev Previous commit
Next Next commit
get_encoding -> getencoding
  • Loading branch information
methane committed Apr 4, 2022
commit 8b50eb10de0805d0eda6a3e9aeb8865d32c6f7b7
6 changes: 3 additions & 3 deletions Lib/locale.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ def getpreferredencoding(do_setlocale=True):
"""Return the charset that the user is likely using."""
if sys.flags.utf8_mode:
return 'UTF-8'
return get_encoding()
return getencoding()
else:
# On Unix, if CODESET is available, use that.
def getpreferredencoding(do_setlocale=True):
Expand All @@ -667,15 +667,15 @@ def getpreferredencoding(do_setlocale=True):
return 'UTF-8'

if not do_setlocale:
return get_encoding()
return getencoding()

old_loc = setlocale(LC_CTYPE)
try:
try:
setlocale(LC_CTYPE, "")
except Error:
pass
return get_encoding()
return getencoding()
finally:
setlocale(LC_CTYPE, old_loc)

Expand Down