# UnicodeEncodeError: 'ascii' codec can't encode character u'\\xa0' in position 84: ordinal not in range(128)

**URL:** <https://forum.ansible.com/t/unicodeencodeerror-ascii-codec-cant-encode-character-u-xa0-in-position-84-ordinal-not-in-range-128/15215>\
**Category:** Ansible Project\
**Created:** [May 12, 2014, 7:30pm UTC](https://forum.ansible.com/t/unicodeencodeerror-ascii-codec-cant-encode-character-u-xa0-in-position-84-ordinal-not-in-range-128/15215 "2014-05-12T19:30:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joel\_Sdc](https://avatars.discourse-cdn.com/v4/letter/j/3ab097/32.png) [@Joel\_Sdc](https://forum.ansible.com/u/Joel_Sdc)\
**Post date:** [May 12, 2014, 7:30pm UTC](https://forum.ansible.com/t/unicodeencodeerror-ascii-codec-cant-encode-character-u-xa0-in-position-84-ordinal-not-in-range-128/15215/1 "2014-05-12T19:30:28Z")

</div>

Hi,

I’m having a little problem. When I run a simple playbook, on some servers I get a UnicodeEncodeError and the playbook is not executed.

I have the role “users\_admin”, it creates 3 groups, makes sure that 4 users exist and have a specific password and set a root password if it has changed.

root@cm:/etc/ansible/roles/users\_admin# tree  
.  
└── tasks  
└── main.yml

1 directory, 1 file  
root@cm:/etc/ansible/roles/users\_admin# cat tasks/main.yml

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [May 12, 2014, 9:16pm UTC](https://forum.ansible.com/t/unicodeencodeerror-ascii-codec-cant-encode-character-u-xa0-in-position-84-ordinal-not-in-range-128/15215/2 "2014-05-12T21:16:12Z")

</div>

Can you try setting “module\_lang = en\_US.UTF-8” in your ansible.cfg to see if that corrects the issue?

---

<div class="post-metadata">

**Author:** ![Joel\_Sdc](https://avatars.discourse-cdn.com/v4/letter/j/3ab097/32.png) [@Joel\_Sdc](https://forum.ansible.com/u/Joel_Sdc)\
**Post date:** [May 13, 2014, 11:41am UTC](https://forum.ansible.com/t/unicodeencodeerror-ascii-codec-cant-encode-character-u-xa0-in-position-84-ordinal-not-in-range-128/15215/3 "2014-05-13T11:41:25Z")

</div>

Hi James,

I have tried:

a) setting “module\_lang = en\_US.UTF-8” in ansible.cfg  
b) editing /usr/share/pyshared/ansible/constants.py and changing:

DEFAULT\_MODULE\_LANG = get\_config(p, DEFAULTS, ‘module\_lang’, ‘ANSIBLE\_MODULE\_LANG’, ‘C’)

to

DEFAULT\_MODULE\_LANG = get\_config(p, DEFAULTS, ‘module\_lang’, ‘ANSIBLE\_MODULE\_LANG’, ‘en\_US.UTF-8’)

In both cases the problem persists.

Any other ideas?

thanks!!

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [May 13, 2014, 12:33pm UTC](https://forum.ansible.com/t/unicodeencodeerror-ascii-codec-cant-encode-character-u-xa0-in-position-84-ordinal-not-in-range-128/15215/4 "2014-05-13T12:33:27Z")

</div>

Go ahead and open an issue on github for this, and we’ll dig into it deeper. If setting the module\_lang doesn’t fix things, then the issue may not be on the client side.

---

<div class="post-metadata">

**Author:** ![Joel\_Sdc](https://avatars.discourse-cdn.com/v4/letter/j/3ab097/32.png) [@Joel\_Sdc](https://forum.ansible.com/u/Joel_Sdc)\
**Post date:** [May 14, 2014, 8:33am UTC](https://forum.ansible.com/t/unicodeencodeerror-ascii-codec-cant-encode-character-u-xa0-in-position-84-ordinal-not-in-range-128/15215/5 "2014-05-14T08:33:38Z")

</div>

Hi James,

Before opening an issue, I have tried after updating to latest ansible version available and the problem is solved.

Should I still open a specific issue for the version I was using prior to upgrade?

Thank you for your help.

Best regards,  
Joel.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [May 14, 2014, 12:24pm UTC](https://forum.ansible.com/t/unicodeencodeerror-ascii-codec-cant-encode-character-u-xa0-in-position-84-ordinal-not-in-range-128/15215/6 "2014-05-14T12:24:17Z")

</div>

No thank you, if it’s already fixed we are good to go.

(For such reasons it’s usually very useful to always indicate the ansible version when discussing a potential bug…)

Thanks!
