title: How to convert a string from Beautiful Soup to utf-8 encoding
body: <p>I'm running a parser in python 2.7 that is taking a text field of xml code from a database and using Beautiful Soup to find and pull different tags in the xml. When I am pulling the  tags from an  tag in the xml and getting to the given text it is returning </p>
  
  <pre><code>&lt;author&gt;
  &lt;name&gt;Josef Šimánek&lt;/name&gt;
  &lt;/author&gt;
  
  Josef \xc5\xa0im\xc3\xa1nek
  </code></pre>
  
  <p>when what it should look like is</p>
  
  <pre><code>Josef Šimánek
  </code></pre>
  
  <p>my relevant code is as follows:</p>
  
  <pre><code>rss = str(f)
  soup = BeautifulSoup(rss)
  entries = soup.findAll('entry')
  for entry in entries:
    author = entry.find('author')
  
    if author != None:
        for name in author.findAll("name"):
            if(checkNull(name).find(",") != -1):
                name = checkNull(name).split(",",1)
                for s in name:
                print s
            else: 
                print name
  </code></pre>
  
  <p>As you can see the code pulls out and cycles through the different tags and if the name tag contains a comma separated list of names, then it splits and prints each individually.</p>
  
  <pre><code>def checkNull(item):
    if item != None:
      return item.text.rstrip()
    return " "
  </code></pre>
  
  <p>Also the check null function is just a helper method to see if the returned tag even contains any text at all as seen above.</p>
  
  <p>I have tried encode, decode, and unicode functions in order to try and resolve the issue however none have succeded. Are there any other methods recommended that i could try to fix this?</p>