mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #46432 from twangboy/win_locales_utf8
Default to UTF-8 for templated files
This commit is contained in:
commit
ac2a6616a7
1 changed files with 8 additions and 1 deletions
|
@ -410,7 +410,14 @@ def render_jinja_tmpl(tmplstr, context, tmplpath=None):
|
|||
decoded_context[key] = value
|
||||
continue
|
||||
|
||||
decoded_context[key] = salt.utils.locales.sdecode(value)
|
||||
try:
|
||||
decoded_context[key] = salt.utils.to_unicode(value, encoding=SLS_ENCODING)
|
||||
except UnicodeDecodeError as ex:
|
||||
log.debug(
|
||||
"Failed to decode using default encoding (%s), trying system encoding",
|
||||
SLS_ENCODING,
|
||||
)
|
||||
decoded_context[key] = salt.utils.locales.sdecode(value)
|
||||
|
||||
try:
|
||||
template = jinja_env.from_string(tmplstr)
|
||||
|
|
Loading…
Add table
Reference in a new issue