What's the best/neatest way to get Unicode data from a database into a grid cell?

cl at isbd.net cl at isbd.net
Sun Feb 7 06:19:25 EST 2016

I'm using this as a starting point for creating a grid to view and
edit some sqlite data:-

I can actually understand most of it which is a good start.  

However my database has quite a lot of Unicode data as there are
French (and other) names with accents etc.  What's the right way to
handle this reasonably neatly?  At the moment it traps an error at
line 37:-
    self.SetCellValue(row_num, i, str(cells[i]))

I realise why this fails (I think) but how should one program this so
    1 - the accented characters are displayed correctly in the grid cell
    2 - One can edit the cell with accented characters

(I'll get round how to get the accented characters back to the
database later!)

My system (xubuntu 15.10) is all UTF8 so accented characters are
handled by the display, in terminals, etc. correctly.  I'm currently
using python 2.7 for this but would be quite happy to move to 3.4 if
this handles UTF8 better (I seem to remember it does maybe).

Chris Green

More information about the Python-list mailing list