# template module setting variables to unicode

**URL:** <https://forum.ansible.com/t/template-module-setting-variables-to-unicode/21774>\
**Category:** Ansible Project\
**Created:** [June 14, 2016, 4:15pm UTC](https://forum.ansible.com/t/template-module-setting-variables-to-unicode/21774 "2016-06-14T16:15:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henry\_Mendez](https://avatars.discourse-cdn.com/v4/letter/h/e68b1a/32.png) [@Henry\_Mendez](https://forum.ansible.com/u/Henry_Mendez)\
**Post date:** [June 14, 2016, 4:15pm UTC](https://forum.ansible.com/t/template-module-setting-variables-to-unicode/21774/1 "2016-06-14T16:15:52Z")

</div>

Hi,

I’ve recently updated from 1.9.1 to 2.0.2.0. I use the template module a lot to build configs for my app. After updating, when I generate my templates, the data structure variables are being rendered as unicode strings.

Versions:

ansible 2.0.2.0PyYAML==3.11  
Jinja2==2.8

Example:  
File with variables:

`

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [August 5, 2016, 12:48pm UTC](https://forum.ansible.com/t/template-module-setting-variables-to-unicode/21774/2 "2016-08-05T12:48:27Z")

</div>

This is a ‘pythonism’, in 2.0 we are much better about handling unicode, a consequence of that is that the structures that were possibly ASCII internally are now all unicode, which python represents as u’'.

If you want a YAML or JSON output (without u’ ') you should use |to\_yaml or |to\_json filters.

---

<div class="post-metadata">

**Author:** ![Henry\_Mendez](https://avatars.discourse-cdn.com/v4/letter/h/e68b1a/32.png) [@Henry\_Mendez](https://forum.ansible.com/u/Henry_Mendez)\
**Post date:** [August 15, 2016, 6:38pm UTC](https://forum.ansible.com/t/template-module-setting-variables-to-unicode/21774/3 "2016-08-15T18:38:23Z")

</div>

That works. Thank you!
