,当我使用sqlite3的数据库SQLAlchemy的图书馆,我得到这个错误SQLite数据库非ASCII字符错误
sqlalchemy.exc.ProgrammingError: (ProgrammingError)
You must not use 8-bit bytestrings unless you use a text_factory that can
interpret 8-bit bytestrings (like text_factory = str).
It is highly recommended that you instead just switch your application
to Unicode strings.
u'INSERT INTO model_pair (user, password) VALUES (?, ?)' ('\xebE\xc2\xe4.\[email protected]', '123456')
,这里是一些测试数据:
呆呆 [email protected] 11111
�言 [email protected] 11111
[email protected]?€? 11111
我已经将数据库编码配置为utf-8或gbk,但是在插入时,我既没有成功,也没有成功 ,我尝试str.decode('gbk'),它将卡住像char一样的字符并得到像上面那样的错误。
有人告诉我如何解决这个错误?
对于遇到同样问题的人,请检查我的答案http://stackoverflow.com/questions/23876342/sqlalchemy-programmingerror-can-interpret-8-bit-bytestrings/38513385#38513385 – cdagli 2016-07-21 20:04:32