# unicode errors and inconsistency.

**URL:** <https://forum.ansible.com/t/unicode-errors-and-inconsistency/31888>\
**Category:** Ansible Project\
**Tags:** rhel, ubuntu, aws\
**Created:** [December 30, 2019, 3:20pm UTC](https://forum.ansible.com/t/unicode-errors-and-inconsistency/31888 "2019-12-30T15:20:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![queglay](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/queglay/32/1807_2.png) [@queglay](https://forum.ansible.com/u/queglay)\
**Post date:** [December 30, 2019, 3:20pm UTC](https://forum.ansible.com/t/unicode-errors-and-inconsistency/31888/1 "2019-12-30T15:20:24Z")

</div>

I get errors when passing some passwords into a shell command and I’d love some pointers on the best way out. The strange thing is, the ansible script works fine on centos 7 in AWS, but not on RHEL 7 on my local machine, and not in my ansible control vagrant virtualbox host (ubuntu 16).

here is an example, the password creates issues.

`

- name: Query houdini filename - Houdini python script  
shell: |  
cd /opt/houdini\_install\_script/  
python /opt/houdini\_install\_script/houdini\_install.py -u ‘{{ sesi\_username }}’ -p ‘{{ sesi\_password }}’ -i /opt/houdini  
register: houdini\_query\_out  
become: true  
when: houdini\_version\_item.houdini\_auto\_version

`

This will produce unicode errors like this -

fatal: [workstation]: FAILED! =\> {}

MSG:

An unhandled exception occurred while templating ‘{{ lookup(‘env’,‘TF\_VAR\_sesi\_password’) }}’. Error was a \<type ‘exceptions.UnicodeDecodeError’\>, original message: ‘ascii’ codec can’t decode byte 0xe2 in position 4: ordinal not in range(128)

Annoyingly, if I b64encode the `sesi_password and then b64decode it in the shell, this then flips the scenario around - it will then work locally in ubuntu 16 and rhel 7, but not in the centos 7 AWS AMI in stead!`

---

<div class="post-metadata">

**Author:** ![queglay](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/queglay/32/1807_2.png) [@queglay](https://forum.ansible.com/u/queglay)\
**Post date:** [December 30, 2019, 4:00pm UTC](https://forum.ansible.com/t/unicode-errors-and-inconsistency/31888/2 "2019-12-30T16:00:00Z")

</div>

I was mistaken, the inconsistency was due to the password var being passed to ansible as extra-vars, this solves the unicode problem and avoids the conversion (default vars get converted to unicode, they cause the problem). I’d like to avoid specifying the password in extra-vars though for security, so I’d love to know an approach to fixing the default vars handling this better.

---

<div class="post-metadata">

**Author:** ![queglay](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/queglay/32/1807_2.png) [@queglay](https://forum.ansible.com/u/queglay)\
**Post date:** [January 8, 2020, 11:07am UTC](https://forum.ansible.com/t/unicode-errors-and-inconsistency/31888/3 "2020-01-08T11:07:43Z")

</div>

Has anyone else run into something similar?
