Repository: Cog-Creators/Red-DiscordBot

Issue:
[V3] UnicodeEncodeError on Windows startup
Please be sure to read through other issues as well to make sure what you are suggesting/reporting has not already
been suggested/reported

### Type:

- [ ] Suggestion
- [X] Bug

### Brief description of the problem
Receiving similar UnicodeEncodeError as Issue #1048.  
```PyNaCl is not installed, voice will NOT be supported
Connected to Discord. Getting ready...
Loading packages...
Loaded packages: image

______         _           ______ _                       _  ______       _
| ___ \       | |          |  _  (_)                     | | | ___ \     | |
| |_/ /___  __| |  ______  | | | |_ ___  ___ ___  _ __ __| | | |_/ / ___ | |_
|    // _ \/ _` | |______| | | | | / __|/ __/ _ \| '__/ _` | | ___ \/ _ \| __|
| |\ \  __/ (_| |          | |/ /| \__ \ (_| (_) | | | (_| | | |_/ / (_) | |_
\_| \_\___|\__,_|          |___/ |_|___/\___\___/|_|  \__,_| \____/ \___/ \__|


Ignoring exception in on_ready
Traceback (most recent call last):
  File "c:\users\aring\appdata\local\programs\python\python35-32\lib\site-packages\discord\client.py", line 223, in _run_event
    yield from coro(*args, **kwargs)
  File "c:\users\aring\appdata\local\programs\python\python35-32\lib\site-packages\redbot\core\events.py", line 129, in on_ready
    print(bordered(INFO, INFO2))
  File "c:\users\aring\appdata\local\programs\python\python35-32\lib\site-packages\colorama\ansitowin32.py", line 40, in write
    self.__convertor.write(text)
  File "c:\users\aring\appdata\local\programs\python\python35-32\lib\site-packages\colorama\ansitowin32.py", line 141, in write
    self.write_and_convert(text)
  File "c:\users\aring\appdata\local\programs\python\python35-32\lib\site-packages\colorama\ansitowin32.py", line 169, in write_and_convert
    self.write_plain_text(text, cursor, len(text))
  File "c:\users\aring\appdata\local\programs\python\python35-32\lib\site-packages\colorama\ansitowin32.py", line 174, in write_plain_text
    self.wrapped.write(text[start:end])
  File "c:\users\aring\appdata\local\programs\python\python35-32\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-36: character maps to <undefined>
```

### Setup
Windows 10
Python 3.5.4
MINGW64 Bash included in https://git-scm.com/downloads distribution



Discussion:
Does this occur for you in the native Command Prompt too?
Command Prompt starts up with no errors.  This seems to be only Git Bash.
Due to the inconsistencies we're having in this issue, I think we should simply make the startup screen entirely ASCII. We've also been having similar issues in SSH clients such as PuTTY.

Although the square root sign looks nicer, I'd be willing to sacrifice it to eliminate these issues.
It turns out that it's not the square root marks which is causing the issue here, but the border characters. By inspection, there are actually no border characters in MINGW's default code page. I'm not quite sure how we're going to work around this
Also occurs on Arch Linux.

Installed prerequisite packages: ```python python-pip git ffmpeg base-devel openssl libffi libsodium```

Installed development version via: ```pip3 install -U --process-dependency-links git+https://github.com/Cog-Creators/Red-DiscordBot@V3/develop#egg=red-discordbot[voice]```

V3 was setup through ```redbot-setup```

Screenshot of log: 

![capture1](https://user-images.githubusercontent.com/841141/34451335-a1d7704a-ecf0-11e7-9c9b-e378ccfbf224.PNG)

Thanks for the extra info. My solution would be for the start screen to be pure ASCII if stdout cannot encode any extended characters. #1206 is a step towards this.

Resolving patch:
diff --git a/redbot/core/events.py b/redbot/core/events.py
--- a/redbot/core/events.py
+++ b/redbot/core/events.py
@@ -117,7 +117,7 @@ async def on_ready():
             ("Tests", reqs_installed["test"])
         )
 
-        on_symbol, off_symbol = _get_settings_symbols()
+        on_symbol, off_symbol, ascii_border = _get_startup_screen_specs()
 
         for option, enabled in options:
             enabled = on_symbol if enabled else off_symbol
@@ -125,7 +125,7 @@ async def on_ready():
 
         print(Fore.RED + INTRO)
         print(Style.RESET_ALL)
-        print(bordered(INFO, INFO2))
+        print(bordered(INFO, INFO2, ascii_border=ascii_border))
 
         if invite_url:
             print("\nInvite URL: {}\n".format(invite_url))
@@ -206,11 +206,18 @@ async def on_resumed():
     async def on_command(command):
         bot.counter["processed_commands"] += 1
 
-def _get_settings_symbols():
-    """Get symbols for displaying settings on stdout.
+def _get_startup_screen_specs():
+    """Get specs for displaying the startup screen on stdout.
 
     This is so we don't get encoding errors when trying to print unicode
     emojis to stdout (particularly with Windows Command Prompt).
+
+    Returns
+    -------
+    `tuple`
+        Tuple in the form (`str`, `str`, `bool`) containing (in order) the
+        on symbol, off symbol and whether or not the border should be pure ascii.
+
     """
     encoder = codecs.getencoder(sys.stdout.encoding)
     check_mark = "\N{SQUARE ROOT}"
@@ -223,4 +230,11 @@ def _get_settings_symbols():
         on_symbol = check_mark
         off_symbol = "X"
 
-    return on_symbol, off_symbol
+    try:
+        encoder('┌┐└┘─│')  # border symbols
+    except UnicodeEncodeError:
+        ascii_border = True
+    else:
+        ascii_border = False
+
+    return on_symbol, off_symbol, ascii_border


Test patch: