title: Python: decode russian string
body: <p>I recieved a list of tuples from a mySQL database.<br>
  When I try to print an item, here is the result:</p>
  
  <pre><code>Ð”Ð°Ð»Ð¾ÐµÐ² ÐÐ»ÐµÐºÑÐ°Ð½Ð´Ñ€
  &lt;class 'str'&gt;
  </code></pre>
  
  <p>This is cp1251, according to <a href="https://2cyr.com/decode/?lang=ru" rel="nofollow">https://2cyr.com/decode/?lang=ru</a></p>
  
  <p>I have tried lots of variations of <code>.encode().decode()</code> with <code>errors='ignore'</code> params but without any success. Any ideas?</p>
  
  <p><strong>UPD</strong>
  I recieve my list of tuples with <code>mysql-connector-python</code>.</p>
  
  <p><code>z</code> is the list. The result above is from <code>z[0][0]</code></p>
  
  <pre><code>def select_name(add):
  z = []
  try:
      dbconfig = read_db_config()
      conn = MySQLConnection(**dbconfig)
      cursor = conn.cursor()
      cursor.execute("select name from phone_add where ph_add = " + str(add) + ";")
  
      row = cursor.fetchone()
      while row is not None:
          z.append(row)
          row = cursor.fetchone()
      return z
  
  except Error as e:
      print(e)
  
  finally:
      cursor.close()
      conn.close()
  </code></pre>
  
  <p><strong>Upd2</strong>
  Here is a wierd decoder.
  Hope it will help smb.</p>
  
  <p>I realised that the problem is in inserting to my DB. Will dig here.</p>
  
  <pre><code>q = string
  
  codings = ['latin1', 'utf8', 'cp1251', 'unicode-escape', 'cp866']
  exceptions = ['ignore', 'strict', 'xmlcharrefreplace', 'backslashreplace']
  for i in codings:
      for j in codings:
          for z in exceptions:
              for p in exceptions:
                  try:
                      print(q.encode(i, errors=z).decode(j, errors=p) + '&lt;------' + i + ' ' + j + ' ' + z + ' ' + p)
                  except:
                      pass
  </code></pre>