# Unicode template character

**URL:** <https://forum.ansible.com/t/unicode-template-character/13006>\
**Category:** Ansible Project\
**Created:** [June 21, 2013, 7:35pm UTC](https://forum.ansible.com/t/unicode-template-character/13006 "2013-06-21T19:35:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Hassinger](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@Paul\_Hassinger](https://forum.ansible.com/u/Paul_Hassinger)\
**Post date:** [June 21, 2013, 7:35pm UTC](https://forum.ansible.com/t/unicode-template-character/13006/1 "2013-06-21T19:35:46Z")

</div>

I’m having issues I cannot seem to get past on my own or with Google searches…

Playbook:

- name: unicode issue  
template: src=mytemplate.conf.j2 dest=/tmp/mytemplate.conf

Output -vvv:

\<[myserver.mydomain.com](http://myserver.mydomain.com)\> EXEC /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-1371842658.09-66206923215967 && chmod a+rx $HOME/.ansible/tmp/ansible-1371842658.09-66206923215967 && echo $HOME/.ansible/tmp/ansible-1371842658.09-66206923215967’

Fatal: [[myserver.mydomain.com](http://myserver.mydomain.com)] =\> {‘msg’: ‘unable to process as utf-8: /home/me/myproject/roles/myrole/templates/mytemplate.conf.j2’, ‘failed’: True}

---

<div class="post-metadata">

**Author:** ![Paul\_Hassinger](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@Paul\_Hassinger](https://forum.ansible.com/u/Paul_Hassinger)\
**Post date:** [June 21, 2013, 7:37pm UTC](https://forum.ansible.com/t/unicode-template-character/13006/2 "2013-06-21T19:37:42Z")

</div>

FYI,

I don’t get the error when I remove the unicode symbol (ø) from mytemplate.conf.j2

---

<div class="post-metadata">

**Author:** ![martin\_f\_krafft](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@martin\_f\_krafft](https://forum.ansible.com/u/martin_f_krafft)\
**Post date:** [June 21, 2013, 7:47pm UTC](https://forum.ansible.com/t/unicode-template-character/13006/3 "2013-06-21T19:47:47Z")

</div>

also sprach Paul Hassinger \<hassinger.paul@ipaul.com\> [2013.06.21.2135 +0200]:

> Fatal: [myserver.mydomain.com] =\> {'msg': 'unable to process as utf-8:  
> /home/me/myproject/roles/myrole/templates/mytemplate.conf.j2', 'failed':  
> True}

suggest you show the template 😉

---

<div class="post-metadata">

**Author:** ![Paul\_Hassinger](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@Paul\_Hassinger](https://forum.ansible.com/u/Paul_Hassinger)\
**Post date:** [June 21, 2013, 8:04pm UTC](https://forum.ansible.com/t/unicode-template-character/13006/4 "2013-06-21T20:04:31Z")

</div>

i can replicate with the ansible/test/sample.j2 template… Resolved if I remove “ø”. The template is as follows:

---

<div class="post-metadata">

**Author:** ![Paul\_Hassinger](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@Paul\_Hassinger](https://forum.ansible.com/u/Paul_Hassinger)\
**Post date:** [June 21, 2013, 8:32pm UTC](https://forum.ansible.com/t/unicode-template-character/13006/5 "2013-06-21T20:32:52Z")

</div>

I pulled off the error handling in ansible/utils/template.py, and get the following error:

fatal: [[myserver.mydomain.com](http://myserver.mydomain.com)] =\> {‘msg’: “‘utf8’ codec can’t decode byte 0xf8 in position 28: invalid start byte”, ‘failed’: True}  
fatal: [[myserver.mydomain.com](http://myserver.mydomain.com)] =\> {‘msg’: “‘utf8’ codec can’t decode byte 0xf8 in position 28: invalid start byte”, ‘failed’: True}

I should also point out that I get the message twice for each server just as above.

---

<div class="post-metadata">

**Author:** ![Paul\_Hassinger](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@Paul\_Hassinger](https://forum.ansible.com/u/Paul_Hassinger)\
**Post date:** [June 21, 2013, 8:43pm UTC](https://forum.ansible.com/t/unicode-template-character/13006/6 "2013-06-21T20:43:34Z")

</div>

OK, I feel stupid now. The project’s file save encoding was reset. I was saving as a Cp1252 file encoding. Issue resolved. Sorry.
