title: Using norwegian letters æøå in python
body: <p>I'm learning python and PyGTK now, and have created a simple Music Organizer.
  <a href="http://pastebin.com/m2b596852" rel="noreferrer">http://pastebin.com/m2b596852</a>
  But when it edits songs with the Norwegian letters æ, ø, and å it's just changing them to a weird character.</p>
  
  <p>So is there any good way of opening or encode the names into utf-8 characters?</p>
  
  <h3>Two relevant places from the above code:</h3>
  
  <p>Read info from a file:</p>
  
  <pre><code>def __parse(self, filename):
      "parse ID3v1.0 tags from MP3 file"
      self.clear()
      self['artist'] = 'Unknown'
      self['title'] = 'Unknown'
      try:
          fsock = open(filename, "rb", 0)
          try:
              fsock.seek(-128, 2)
              tagdata = fsock.read(128)
          finally:
              fsock.close()
          if tagdata[:3] == 'TAG':
              for tag, (start, end, parseFunc) in self.tagDataMap.items():
                  self[tag] = parseFunc(tagdata[start:end])
      except IOError:
          pass
  </code></pre>
  
  <p>Print to sys.stdout info:</p>
  
  <pre><code>for info in files:
      try:
          os.rename(info['name'], 
              os.path.join(self.dir, info['artist'])+' - '+info['title']+'.mp3')
  
          print 'From: '+ info['name'].replace(os.path.join(self.dir, ''), '')
          print 'To:   '+ info['artist'] +' - '+info['title']+'.mp3'
          print
          self.progressbar.set_fraction(i/num)
          self.progressbar.set_text('File %d of %d' % (i, num))
          i += 1
      except IOError:
          print 'Rename fail'
  </code></pre>