PythonGTK - 无法将特殊字符写入数据库
PythonGTK - Can't write special characters into database
我编写了以下写入 sqlite3 的程序 table:
https://www.adrive.com/public/sJZKt3/program.py
它工作正常,但在尝试保存语言特定字符时除外,例如:
Ää,ß, ç
尝试插入 table 时,我收到以下错误消息:
SQL Error
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.
我该如何解决?
将文本更改为 unicode 以便您可以插入
text = "äöü"
text = text.decode("utf8")
我编写了以下写入 sqlite3 的程序 table:
https://www.adrive.com/public/sJZKt3/program.py
它工作正常,但在尝试保存语言特定字符时除外,例如:
Ää,ß, ç
尝试插入 table 时,我收到以下错误消息:
SQL Error
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.
我该如何解决?
将文本更改为 unicode 以便您可以插入
text = "äöü"
text = text.decode("utf8")