title: UnicodeEncodeError: 'latin-1' codec can't encode characters in position 11-12: ordinal not in range(256)
body: <p>The code below downloads a log from the game server and uploads them back to a website for display.  I am however getting a UnicodeError when the bot itself does not read logs.  I am using a &quot;logalyzer.exe&quot; to parse these logs once they reach my machine.  When I parse the logs with the logalyzer.exe without the use of the bot it parses just fine, but when going through this bot.. it gives me the unicode error that is in the title.</p>
  <p>Only happens when a player uses a special character in his/her name..</p>
  <p>Edit: according to MSVC code.. line 22 is the culprit.. ftp.storbinary('STOR %s' % f, fh) .. will be investigating why unless someone knows?</p>
  <pre><code>def uploadThis(path, ftp):
      files = os.listdir(path)
      os.chdir(path)
      for f in files:
          if os.path.isfile(path + r'\{}'.format(f)):
              fh = open(f, 'rb')
              ftp.storbinary('STOR %s' % f, fh)
              fh.close()
          elif os.path.isdir(path + r'\{}'.format(f)):
              ftp.mkd(f)
              ftp.cwd(f)
              uploadThis(path + r'\{}'.format(f), ftp)
      ftp.cwd('..')
      os.chdir('..')
  
      
  @client.command(pass_context=True)
  @commands.has_role('Sanitation Engineers')
  @commands.cooldown(1, 300, commands.BucketType.guild)
  async def stats(ctx):
      await ctx.send(&quot;Creating and Foomalyzing server logs.. this may take at least 1 minute...&quot;)    
      logToParse1 = &quot;&quot;
      logToParse2 = &quot;&quot;
      roundOneLink = &quot;&quot;
      roundTwoLink = &quot;&quot;
      path = variables['path']
      imagePath = variables['imagepath']  
      stylePath = variables['stylepath']
  
      ftp = FTP(variables['FTPHOST'], user = variables['USER'], passwd= variables['PASSWORD'])
      ftp.cwd(variables['ftppath'])
      dirList = ftp.nlst()
      logs = []
      c = -1
      print(dirList)
      for i in dirList:
          if(&quot;.log&quot; in i):
              logs.append(i)
      for i in range(len(logs)):
          if(int(ftp.size(logs[c])) &gt; 60000):
              logToParse2 = logs[c]
              print(logToParse2)
              break
          else:
              c = c - 1
      c = c - 1
      for i in range(len(logs)):
          if(int(ftp.size(logs[c])) &gt; 60000):
              logToParse1 = logs[c]
              print(logToParse1)
              break
          else:
              c = c - 1
      parseFolder1 = logToParse1[:-4]
      parseFolder2 = logToParse2[:-4]
      ftp.retrbinary(&quot;RETR &quot; + logToParse1, open(logToParse1, 'wb').write)
      ftp.retrbinary(&quot;RETR &quot; + logToParse2, open(logToParse2, 'wb').write)
      ftp.quit()
  
      ftp = FTP(variables['SITEHOST'], user = variables['USER2'], passwd= variables['PASSWORD2'])
      ftp.cwd('public')
      ftp.cwd('logs')
      print(ftp.nlst())
      siteList = ftp.nlst()
  
      if (parseFolder1 in siteList):
          print(&quot;Folder already exists, no upload necessary&quot;)
          roundOneLink = variables[&quot;URLPATH&quot;] + parseFolder1 + &quot;/&quot;
      else:
          roundOneLink = variables[&quot;URLPATH&quot;] + parseFolder1 + &quot;/&quot;
          os.mkdir(parseFolder1)
          desPath = variables['despath'] + parseFolder1
  
          os.system('cmd /c ' + variables['DRIVE'] + ' &amp;&amp; cd %s &amp;&amp; logalyzer -image %s -style %s -o %s %s' % (path, imagePath, stylePath, parseFolder1, logToParse1))
          ftp.mkd(parseFolder1)
          ftp.cwd(parseFolder1)
          uploadThis(desPath, ftp)
          os.remove(logToParse1)
          shutil.rmtree(path + parseFolder1)
  
      if (parseFolder2 in siteList):
          print(&quot;Folder already exists, no upload necessary&quot;)
          roundTwoLink = variables[&quot;URLPATH&quot;] + parseFolder2 + &quot;/&quot;
      else:
          roundTwoLink = variables[&quot;URLPATH&quot;] + parseFolder2 + &quot;/&quot;
          os.mkdir(parseFolder2)
          desPath = variables['despath'] + parseFolder2
  
          os.system('cmd /c ' + variables['DRIVE'] + ' &amp;&amp; cd %s &amp;&amp; logalyzer -image %s -style %s -o %s %s' % (path, imagePath, stylePath, parseFolder2, logToParse2))
          ftp.mkd(parseFolder2)
          ftp.cwd(parseFolder2)
          uploadThis(desPath, ftp)
          os.remove(logToParse2)
          shutil.rmtree(path + parseFolder2)
  
      await ctx.send(&quot;Round 1: &quot; + roundOneLink)
      await ctx.send(&quot;Round 2: &quot; + roundTwoLink)
  
      ftp.quit()
  </code></pre>