私はSQLAlchemyのライブラリとsqlite3のデータベースを使用する場合、私はこのエラーに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')を試してみましたが、上記のようなエラーが表示されます。
誰でもこのエラーを回避する方法を教えてください。
同じ問題が発生した場合は、私の答えを確認してください。http://stackoverflow.com/questions/23876342/sqlalchemy-programmingerror-can-interpret-8-bit-bytestrings/38513385#38513385 – cdagli