SQLite - Insert special symbols (trademark, …) into table

偶尔善良 提交于 2019-12-11 02:42:24

问题


How can I insert special symbols like trademark into SQLite table? I have tried to use PRAGMA encoding = "UTF-16" with no effect :(


回答1:


Typically if you surround an SQL entry with ''Single quotes, it goes in as a literal.

i.e.

'™'



回答2:


problem solved. it is necessary to open DB file with sqlite3_open16, then execute command PRAGMA encoding = \"UTF-16\"; (I am not sure, if it is necessary). Now the insert will be done with UTF-16. To select from db (to get column value) is necessary to use sqlite3_column_text16 function



来源:https://stackoverflow.com/questions/3778556/sqlite-insert-special-symbols-trademark-into-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!