title: How to decode cp1252 string?
body: <p>I am getting an mp3 tag (ID V1) with eyeD3 and would like to understand its encoding. Here is what I try:</p>
  
  <pre><code>&gt;&gt;&gt; print(type(mp3artist_v1))
  &lt;type 'unicode'&gt;
  
  &gt;&gt;&gt; print(type(mp3artist_v1.encode('utf-8')))
  &lt;type 'str'&gt;
  
  &gt;&gt;&gt; print(mp3artist_v1)
  Zåìôèðà
  
  &gt;&gt;&gt; print(mp3artist_v1.encode('utf-8').decode('cp1252'))
  ZÃ¥Ã¬Ã´Ã¨Ã°Ã 
  
  &gt;&gt;&gt; print(u'Zемфира'.encode('utf-8').decode('cp1252'))
  ZÐµÐ¼Ñ„Ð¸Ñ€Ð°
  </code></pre>
  
  <p>If I use an <a href="http://www.artlebedev.ru/tools/decoder/" rel="nofollow">online tool</a> to decode the value, it says that the value <code>ZÐµÐ¼Ñ„Ð¸Ñ€Ð°</code> could be converted to correct value <code>Zемфира</code> by changing encodings <code>CP1252 → UTF-8</code> and value <code>Zåìôèðà</code> by changing encodings like <code>CP1252 → CP1251</code>.</p>
  
  <p>What should I do to get <code>Zемфира</code> from <code>mp3artist_v1</code>? <code>.encode('cp1252').decode('cp1251')</code> works well, but how can I understand possible encoding automatically (just 3 encodings are possible - <code>cp1251</code>, <code>cp1252</code>, <code>utf-8</code>? I was planning to use the following code:</p>
  
  <pre><code>def forceDecode(string, codecs=['utf-8', 'cp1251', 'cp1252']):
      for i in codecs:
          try:
              print(i)
              return string.decode(i)
          except:
              pass
      print "cannot decode url %s" % ([string]) 
  </code></pre>
  
  <p>but it does not help since I should encode with one charset first and then decode with another.</p>