On Sat, Sep 26, 2009 at 11:04:17PM +1000, aj scratched on the wall:
> 
> what encoding does sqlite_exec() callback function receive data in ?
> 
> some tests i've done seem to suggest UTF-8
> 
> other tests show chars U+80 to U+FF are returned as single chars with 
> values 128-255. (suggesting its not UTF-8)

  The callback values are generated with sqlite3_column_text().  I'm
  not sure where I remember reading that, but a quick glance at the
  code confirms it.

  This has a pretty good run-down on how the conversion process takes
  place for everything but TEXT to TEXT.  I assume strings are encoded
  in UTF-8, but that may not be true of other values.  One specific
  thing to be aware of is that BLOBs are not converted, and are a bit
  of a mess (as you would expect):

  http://sqlite.org/c3ref/column_blob.html      
  (I know it doesn't look like it, but that's the right page)

  It is worth remembering that sqlite3_exec() is a legacy function from
  SQLite v2.  It only returns strings, so you have no type information.
  While it is still supported, it isn't exactly recommended.  There
  are a number of reasons why the use of an explicit of the
  prepare/bind/step/finalize APIs is a better choice.  Getting proper
  type information and native data types back out of your queries is
  just a few of those reasons.

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Our opponent is an alien starship packed with atomic bombs.  We have
 a protractor."   "I'll go home and see if I can scrounge up a ruler
 and a piece of string."  --from Anathem by Neal Stephenson
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to