# Why does ansible change LANG to C?

**URL:** <https://forum.ansible.com/t/why-does-ansible-change-lang-to-c/14993>\
**Category:** Ansible Project\
**Created:** [April 11, 2014, 1:43am UTC](https://forum.ansible.com/t/why-does-ansible-change-lang-to-c/14993 "2014-04-11T01:43:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alistair\_Bayley](https://avatars.discourse-cdn.com/v4/letter/a/96bed5/32.png) [@Alistair\_Bayley](https://forum.ansible.com/u/Alistair_Bayley)\
**Post date:** [April 11, 2014, 1:43am UTC](https://forum.ansible.com/t/why-does-ansible-change-lang-to-c/14993/1 "2014-04-11T01:43:36Z")

</div>

We’ve tracked down a bug in our ansible-driven build to the LANG environment variable being explicitly set to “C”. I’m wondering why this is done i.e. why modify it at all? Why not just use the environment of the user/account executing the ansible script? It was confusing, because running the same commands manually from the ansible user account did not reproduce the fault.

I found this post:  
[https://groups.google.com/forum/#!topic/ansible-project/HD3yxPfsnzg](https://groups.google.com/forum/#!topic/ansible-project/HD3yxPfsnzg)

which says that it is done to avoid encoding issues; which is ironic, as it has caused us encoding issues…

We’ve set module\_lang = en\_NZ.UTF-8 in ansible.cfg for now.

---

<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:** [April 15, 2014, 9:06pm UTC](https://forum.ansible.com/t/why-does-ansible-change-lang-to-c/14993/2 "2014-04-15T21:06:24Z")

</div>

It’s done because various modules rely on parsing Unix commands and these commands are difficult to parse in different languages.

The proposal has been made that if LANG is set in the environment, we possibly not set LANG, though we’ll need to consider implications.

It may be that only certain modules need to set the LANG to C, so it may warrant reading history and audit specifically what changes may have to occur.

---

<div class="post-metadata">

**Author:** ![Strahinja\_Kustudic2](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Strahinja\_Kustudic2](https://forum.ansible.com/u/Strahinja_Kustudic2)\
**Post date:** [April 17, 2014, 9:47pm UTC](https://forum.ansible.com/t/why-does-ansible-change-lang-to-c/14993/3 "2014-04-17T21:47:01Z")

</div>

The first modules that should use the default system LANG are command and shell. Having them as C can give a lot of problems, especially if you are inserting something into a database which is UTF8.

---

<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:** [April 17, 2014, 10:20pm UTC](https://forum.ansible.com/t/why-does-ansible-change-lang-to-c/14993/4 "2014-04-17T22:20:37Z")

</div>

I’d agree especially for those.

Please make sure there’s a ticket filed if you can’t find one already. We’ll probably want to research a bit more which specifically should make modifications.

---

<div class="post-metadata">

**Author:** ![Strahinja\_Kustudic2](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Strahinja\_Kustudic2](https://forum.ansible.com/u/Strahinja_Kustudic2)\
**Post date:** [April 18, 2014, 8:05pm UTC](https://forum.ansible.com/t/why-does-ansible-change-lang-to-c/14993/5 "2014-04-18T20:05:49Z")

</div>

[Issue 7060](https://github.com/ansible/ansible/issues/7060) created.
