Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #102624

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

From cl@isbd.net
Newsgroups comp.lang.python
Subject What's the best/neatest way to get Unicode data from a database into a grid cell?
Date 2016-02-07 11:19 +0000
Message-ID <tqljoc-nad.ln1@esprimo.zbmc.eu> (permalink)

Show all headers | View raw


I'm using this as a starting point for creating a grid to view and
edit some sqlite data:-
    http://www.salstat.com/news/linking-wxgrid-to-sqlite-database-in-python-an-example

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
that:-
    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
ยท

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

What's the best/neatest way to get Unicode data from a database into a grid cell? cl@isbd.net - 2016-02-07 11:19 +0000
  Re: What's the best/neatest way to get Unicode data from a database into a grid cell? Chris Angelico <rosuav@gmail.com> - 2016-02-07 22:56 +1100
    Re: What's the best/neatest way to get Unicode data from a database into a grid cell? cl@isbd.net - 2016-02-07 12:42 +0000
      Re: What's the best/neatest way to get Unicode data from a database into a grid cell? Chris Angelico <rosuav@gmail.com> - 2016-02-08 00:11 +1100
        Re: What's the best/neatest way to get Unicode data from a database into a grid cell? cl@isbd.net - 2016-02-07 13:59 +0000
  Re: What's the best/neatest way to get Unicode data from a database into a grid cell? Dietmar Schwertberger <maillist@schwertberger.de> - 2016-02-07 16:06 +0100
    Re: What's the best/neatest way to get Unicode data from a database into a grid cell? cl@isbd.net - 2016-02-08 10:22 +0000
      Re: What's the best/neatest way to get Unicode data from a database into a grid cell? Chris Angelico <rosuav@gmail.com> - 2016-02-08 21:57 +1100
  Re: What's the best/neatest way to get Unicode data from a database into a grid cell? Vlastimil Brom <vlastimil.brom@gmail.com> - 2016-02-07 19:22 +0100
    Re: What's the best/neatest way to get Unicode data from a database into a grid cell? cl@isbd.net - 2016-02-08 10:42 +0000
      Re: What's the best/neatest way to get Unicode data from a database into a grid cell? Chris Angelico <rosuav@gmail.com> - 2016-02-08 21:55 +1100
      Re: What's the best/neatest way to get Unicode data from a database into a grid cell? Vlastimil Brom <vlastimil.brom@gmail.com> - 2016-02-08 16:00 +0100

csiph-web