Skip to content

Commit ea65712

Browse files
committed
Improve locale._normalize_locale() by dropping the charmap.
1 parent efeed3e commit ea65712

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

salt/modules/localemod.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ def set_locale(locale):
145145

146146

147147
def _normalize_locale(locale):
148+
# depending on the environment, the provided locale will also contain a charmap
149+
# (e.g. 'en_US.UTF-8 UTF-8' instead of only the locale 'en_US.UTF-8')
150+
# drop the charmap
151+
locale = locale.split()[0]
152+
148153
lang_encoding = locale.split('.')
149154
lang_split = lang_encoding[0].split('_')
150155
if len(lang_split) > 1:

0 commit comments

Comments
 (0)