title: Python 3 unicode encode error
body: <p>I'm using glob.glob to get a list of files from a directory input. When trying to open said files, Python fights me back with this error:</p>
  
  <blockquote>
    <p>UnicodeEncodeError: 'charmap' codec can't encode character '\xf8' in position 18: character maps to &lt; undefined ></p>
  </blockquote>
  
  <p>By defining a string variable first, I can do this:</p>
  
  <pre><code>filePath = r"C:\Users\Jørgen\Tables\\"
  </code></pre>
  
  <p>Is there some way to get the 'r' encoding for a variable?</p>
  
  <p>EDIT:</p>
  
  <pre><code>import glob
  
  di = r"C:\Users\Jørgen\Tables\\"
  
  def main():
      fileList = getAllFileURLsInDirectory(di)
      print(fileList)
  
  def getAllFileURLsInDirectory(directory):
      return glob.glob(directory + '*.xls*')
  </code></pre>
  
  <p>There is a lot more code, but this problem stops the process.</p>