mercredi 31 décembre 2014

OSX: PySide WebKit bridge and sqlite and utf-8

I've created a sqlite database frontent to manage cooking recipes. It uses a html file displayed by PySide's QWebKit module as UI (python2.7).


Among other functions, displayed recipes can be filtered by tags and searched by titles. Tags and titles may (will!) contain German umlauts.


The application works well, umlaut-strings can be exchanged between the Python module, the sqlite database and the HTML/JavaScript interface - if and only if python is invoked from the shell or by double-clicking chmod'd file on linux.


Under OSX however, to be able to run an application I have to wrap it somehow. I tried py27-py2app 0.9_1 as well as Platypus 4.4, both with the same result:


The utf-8 encoded strings with umlauts get exchanged between Python and JS/HTML, but the sqlite module suddenly can't use them to search and filter entries anymore.


I already tried including an intermediate step of making the app launch a shell script which exports a number of variables (LC_ALL, LANG,...) and then calls the python interpreter, but it didn't change anything.


Any clues/ideas?


Full source code can be found at https://github.com/hermann-p/recipes (expect sloppy style and many results of trial-and-error learning of css/sqlite)


Aucun commentaire:

Enregistrer un commentaire