Repository: dynaconf/dynaconf

Issue:
[bug]  UnicodeEncodeError upon dynaconf init
**Describe the bug**

`dynaconf init -f yaml` results in a `UnicodeEncodeError `

**To Reproduce**
Steps to reproduce the behavior:

1. `git clone -b dynaconf https://github.com/ebenh/django-flex-user.git`
2. `py -m pipenv install --dev`
3. `py -m pipenv shell`
4. `export DJANGO_SETTINGS_MODULE=test_project.settings`
5. `dynaconf init -f yaml`


**Error Message**

```
Traceback (most recent call last):
  File "C:\Users\eben\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\eben\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\eben\.virtualenvs\django-flex-user-ab_cVlY8\Scripts\dynaconf.exe\__main__.py", line 7, in <module>
  File "c:\users\eben\.virtualenvs\django-flex-user-ab_cvly8\lib\site-packages\dynaconf\vendor\click\core.py", line 221, in __call__
    def __call__(A,*B,**C):return A.main(*B,**C)
  File "c:\users\eben\.virtualenvs\django-flex-user-ab_cvly8\lib\site-packages\dynaconf\vendor\click\core.py", line 205, in main
    H=E.invoke(F)
  File "c:\users\eben\.virtualenvs\django-flex-user-ab_cvly8\lib\site-packages\dynaconf\vendor\click\core.py", line 345, in invoke
    with C:return F(C.command.invoke(C))
  File "c:\users\eben\.virtualenvs\django-flex-user-ab_cvly8\lib\site-packages\dynaconf\vendor\click\core.py", line 288, in invoke
    if A.callback is not _A:return ctx.invoke(A.callback,**ctx.params)
  File "c:\users\eben\.virtualenvs\django-flex-user-ab_cvly8\lib\site-packages\dynaconf\vendor\click\core.py", line 170, in invoke
    with G:return A(*B,**E)
  File "c:\users\eben\.virtualenvs\django-flex-user-ab_cvly8\lib\site-packages\dynaconf\vendor\click\decorators.py", line 21, in A
    def A(*A,**B):return f(get_current_context(),*A,**B)
  File "c:\users\eben\.virtualenvs\django-flex-user-ab_cvly8\lib\site-packages\dynaconf\cli.py", line 257, in init
    click.echo("\u2699\ufe0f  Configuring your Dynaconf environment")
  File "c:\users\eben\.virtualenvs\django-flex-user-ab_cvly8\lib\site-packages\dynaconf\vendor\click\utils.py", line 82, in echo
    if A:B.write(A)
  File "C:\Users\eben\AppData\Local\Programs\Python\Python37\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-1: character maps to <undefined>

```



Discussion:
I suspect this problem is related to the emojis on https://github.com/rochacbruno/dynaconf/blob/master/dynaconf/cli.py#L283

We need to find a way to safely output the emojis on windows, make it optional or remove it completelly.
I'm trying to reproduce this, and will go study to correct.
![image](https://user-images.githubusercontent.com/11020807/136447731-38c1d50e-b669-4903-ac8e-e7fd3a23f673.png)

This issue seems to have been fixed in latest Windows updates. https://github.com/microsoft/terminal/issues/190

I'm researching if this fix is only in Newer Builds. (I'm using Windows 11), and seeing how we can work around to not break the execution in older builds.

@ebenh What your windows version for me reproduce this in Virtual Machine?
> @ebenh What your windows version for me reproduce this in Virtual Machine?

Windows 7 x64
@ebenh you are using python 37, 38 or 39? 
I will testing with 3.7 :)

Edit: I managed to reproduce the error with Python379 on Windows 7 Ultimate x64, I will try to bypass it.
@ebenh to bypass this error i found this solution:

![image](https://user-images.githubusercontent.com/11020807/136593420-c30d1ca5-b355-4a3d-bd12-027aba5510be.png)

You can use:

```
set PYTHONIOENCODING=utf-8
```

or 

```
export PYTHONIOENCODING=utf-8
```

Source: [Stackoverflow](https://stackoverflow.com/questions/6344853/python-unicode-in-windows-terminal-encoding-used)

---

@rochacbruno We can add this env directly into Dynaconf or put a manual for use on Windows systems with older builds, I think this can also happen on Windows 8 and Windows 8.1.
What do you prefer?
@endersonmenezes does it work if we put `os.environ["PYTHONIOENCODING"] = "utf-8"` on the top of the CLI file? of not then we can just add a note on the docs about this problem.

Or as a second option, remove all the emojis from the CLI output?

What do you think?

Probably getting rid of emojis is safer option https://github.com/pypa/pipenv/issues/3131 
I think we can keep the emojis and use [PYTHONIOENCODING](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONIOENCODING), as our String is passed by IO, just when it's not able to decode it will remove it, so we have the two solutions:
- Emojis removed where they don't work.
- Emojis working for those who like to put emojis on everything (like me) 😄

I think `os.environ["PYTHONIOENCODING"] = "utf-8"` the change will not change anything for newer devices that already have this by default, and helps users more, makes a learning curve for using dynaconf shorter, i can make a PR?

EDIT: The result would be similar to this change, simpler. https://github.com/pypa/pipenv/pull/3132/files

Resolving patch:
diff --git a/dynaconf/cli.py b/dynaconf/cli.py
--- a/dynaconf/cli.py
+++ b/dynaconf/cli.py
@@ -23,6 +23,7 @@
 from dynaconf.vendor import click
 from dynaconf.vendor import toml
 
+os.environ["PYTHONIOENCODING"] = "utf-8"
 
 CWD = Path.cwd()
 EXTS = ["ini", "toml", "yaml", "json", "py", "env"]


Test patch: