Pymysql Python 2.7与unicode utf8泰语语言错误

时间:2019-01-11 05:07:23

标签: mysql python-2.7

我在python 2.7中使用pymysql.connect连接MySQL V.5.6.36服务器Chaset:UTF-8 Unicode(utf8),结果显示错误

  

“ u'\ u0e1b \ u0e15 \ u0e17。\ u0e40 \ u0e01 \ u0e35 \ u0e22 \ u0e23 \ u0e15 \ u0e34 \ u0e4c \ u0e1b \ u0e34 \ u0e22 \ u0e09 \ u0e31 \ u0e15'

但是正确的语言应该是泰语,所以我也添加了charset =“ utf8”,但仍然显示相同的问题

# -*- coding: utf-8 -*-
connection = pymysql.connect(host="www.xxxxxx.xxxx",
                             user="xxxxxx",
                             passwd="xxxxx",
                             db="test",
                             charset="utf8",
                             use_unicode=True
                            )
cursor = connection.cursor()
sql1 = ("SELECT "
        "ID,"
        "expired_date,"
        "name  FROM site")

cursor.execute(sql1)
date_check = cursor.fetchall()

0 个答案:

没有答案