using Python3 and sqlite3 with complex unicode strings

I have to store complex unicode strings like "ʘ̃" (an IPA symbol) in a database. These strings involve peculiar characters, like k͡p with unusual diacritics. I decided to use sqlite3 and wrote the following lines in order to create my database :

import sqlite3
conn = sqlite3.connect('/tmp/example.db')
c = conn.cursor()
c.execute('create table mytable (mystring unicode)')
c.execute("insert into mytable values ('ʘ̃ʘ͡qʘ͡qʼ)")

Then I read 'mytable' with these instructions :

c.execute('select * from mytable order by trans')
for row in c:
    print(c)

But I get only an ill-formed string with missing characters while the most simple characters in my string remain. The same code works perfectly well with usual characters (like é, â, ö, ...). This code comes from the Python 3.2.3 documentation. Is sqlite3 not able to store ANY unicode character ?

Any help would be greatly appreciated !

PS : my file uses utf-8 encoding :

# -*- coding: utf-8 -*-

Answers


Sorry for the inconvenience but my code works perfectly well : it was my terminal that displayed wrong informations about the values returned by sqlite.


Need Your Help

How can I implement Nancy.Authentication.Token in a web application?

security authentication nuget token nancy

I'd like to use the Authentication.Token method in a Nancy application, but there is not that package on NuGet yet.

How to fetch partial data from an active coonection?

php curl fsockopen

I making a script which save some no. ( any type of unique 9 digit no. ) from fetching a page .

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.