zoukankan      html  css  js  c++  java
  • utf8 or utf8

    conn = MySQLdb.connect('localhost', '****', '****', '****', charset='utf-8')

    Traceback (most recent call last):
    File "E:\project\wx_in_action\example3_4.py", line 24, in OnMouseDown
    conn = MySQLdb.connect('localhost', '****', '*****', '*****', charset='utf-8')
    File "C:\Python25\Lib\site-packages\MySQLdb\__init__.py", line 74, in Connect
    return Connection(*args, **kwargs)
    File "C:\Python25\Lib\site-packages\MySQLdb\connections.py", line 198, in __init__
    self.set_character_set(charset)
    File "C:\Python25\Lib\site-packages\MySQLdb\connections.py", line 277, in set_character_set
    super(Connection, self).set_character_set(charset)
    _mysql_exceptions.OperationalError: (2019, "Can't initialize character set utf-8 (path: C:\\mysql\\\\share\\charsets\\)")


    使用GB2312可以连接成功:

    conn = MySQLdb.connect('localhost', '****', '****', '****', charset='gb2312)
     
    正确的方法:
    conn = MySQLdb.connect('localhost', '****', '****', '****', charset='utf8)
     
    一个小横杠,困扰我N久。
     
    不只是我啊!
    http://www.cn-cuckoo.com/2010/08/07/thanks-for-my-friends-1822.html
  • 相关阅读:
    TCP四种定时器--学习笔记
    Python魔术师--self
    python的socket里 gethostbyname 与 gethostbyname_ex 的区别
    用python查看URL编码的中文
    基于linux 的2048
    用灵活的指针访问类私有变量
    ie8无法拉伸背景图
    图片的onerror 事件解析
    stream.js
    Promise
  • 原文地址:https://www.cnblogs.com/crafter/p/2262914.html
Copyright © 2011-2022 走看看