title: pymysql incorrect writes to the database the Russian text
body: <p>I had the following problem: is There a site encoded in windows-1251. I'm using the library BeautifulSoup to get the data you need in Russian language. For testing recorded the values in the file, they are displayed correctly. Then I tried to record this data to the database, but got this error: <code>Warning: (1366, "Incorrect string value: '\\x98\\xD0\\xBD\\xD1\\x82\\xD0...' for column 'description' at row 1")
  </code>The database encoding is utf-8.
  Below code demonstrates how to read html file:</p>
  
  <pre><code>def get_html(url):
  req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
  response = urllib.request.urlopen(req)
  return response.read()
  </code></pre>
  
  <p>The code below demonstrates how to write values to the database:</p>
  
  <pre><code>def write_to_db(chars, desc):
      conn = pymysql.connect(host='localhost',
          port=3307, 
          user='****',
          password='****',
          db='****',
          charset='utf8', 
          cursorclass=pymysql.cursors.DictCursor)
  
  global _id
  with conn.cursor() as cursor:
      sql = "INSERT INTO `articles` (`id_cat`, `characteristics`, `description`) VALUES (%s, %s, %s)"
      cursor.execute(sql, (_id, chars, desc))
  conn.commit()
  </code></pre>
  
  <p>In the end we get in the database the following characters:<code>РњРѕРґРµР»СЊ</code></p>
  
  <p>How can I overcome this problem?</p>