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

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

Can you try setting “module_lang = en_US.UTF-8” in your ansible.cfg to see if that corrects the issue?

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!!

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.

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.

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!