String comparison with text from different encoding

8 views
Skip to first unread message

kcdenoy

unread,
Nov 29, 2018, 6:40:08 AM11/29/18
to Ansible Project
Hi all,

I wanted to know if such is possible?
The environment has a host using 'euc-jp' as its encoding.

I'm aware that a result from a command task (e.g. shell: echo "hello world") is automatically converted to 'utf-8' encoding. Is it possible to test strings or similar that is using a different encoding?

Example,

sample.yml
-----
- shell: script.sh
register: res

- debug:
msg: "foobar"
when: res.stdout is search("完了") = True


script.sh <= script is in euc-jp encoding
-----
... # some code here
echo "完了"
Reply all
Reply to author
Forward
0 new messages