Problems with \u001b[31m ANSI colour codes

Ansible Version:
ansible 2.9.4
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/gobi/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /home/gobi/.local/lib/python2.7/site-packages/ansible
executable location = /home/gobi/.local/bin/ansible
python version = 2.7.17 (default, Nov 7 2019, 10:07:09) [GCC 7.4.0]

COMPONENT NAME
debug

Summary:
While running git status or any other commands, the deleted and marked files are shown in red or any other colours. When trying to store the results of the commands in a register and print the values using debug module \u001b[31m or any other ANSI code will append to the result. The debug will print the result in default green colour, maybe this is the reason for this issue.
How can be \u001b[31m these are avoided?

In my terminal normal git status command:
image

using

shell: git status
register: temp_reg
debug: msg="{{temp_reg.stdout_lines}}
image

I think your problem is that you have colors enabled in the non-interactive mode of your shell,
which doesn't make sense all.

Check your shell configuration files, e.g. ~/.bashrc has usually a condition for non-interactive
mode:

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

Regards
         Racke