mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Handle UTF-8 in templates
This is required to run commands containing non-ASCII characters, e.g.: ansible localhost -m shell -a 'echo ą'
This commit is contained in:
parent
4121109665
commit
2aef0335cb
1 changed files with 4 additions and 0 deletions
|
@ -215,6 +215,10 @@ def template(text, vars):
|
|||
''' run a text buffer through the templating engine until it no longer changes '''
|
||||
|
||||
prev_text = ''
|
||||
try:
|
||||
text = text.decode('utf-8')
|
||||
except UnicodeEncodeError:
|
||||
pass # already unicode
|
||||
depth = 0
|
||||
while prev_text != text:
|
||||
depth = depth + 1
|
||||
|
|
Loading…
Reference in a new issue