Thanks!

Likely I will stick with UTF8, however I'm having a hard time detecting
(programmatically) when a file is UTF16.  I've tried the 'file' command on
the command line, but it just returns the file as 'data'

I'll likely have to find a way to detect this in perl, then do the
conversion with iconv before popping it into the database.

Don't do that.  Look up how to use placeholders in the DBI manual.
>

Thanks for that tip, will research that as well.

On Thu, Oct 28, 2010 at 11:58 AM, Drake Wilson <dr...@begriffli.ch> wrote:

> Quoth "J. Bobby Lopez" <j...@jbldata.com>, on 2010-10-28 11:48:12 -0400:
> > And here it is again when less (which doesn't translate the UTF8 text):
> > t...@y^@p...@e^@ ^@ ^@ ^@ ^@ ^@ ^...@t^@i...@m^@e^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ 
> > ^@ ^@
> ^@
> > ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^...@u^@s...@e^@r^@ ^@ ^@ ^@ ^@ ^@ ^@
> > ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@
> ^...@d^@e...@s^@c...@r^@i...@p^@t...@i^@o...@n^@
> > ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^...@^m^@
>
> That's little-endian UTF-16.
>
> > Here is how I'm trying to insert the line into the database (perl):
> >
> >         $insert_sql = "insert into data (filename, line) values (" .
> > $dbh->quote($file) . "," . $dbh->quote($line) . ")";
> >         $dbh->do( $insert_sql );
>
> Don't do that.  Look up how to use placeholders in the DBI manual.
>
> > Another think that crossed my mind is that maybe I haven't set up the
> > database properly to accept UTF8 or UTF16 data, but I figured this was a
> > default in SQLite3.
>
> You have to pick one when you create the database, usually UTF-8.  If
> you want UTF-16 use « PRAGMA encoding = 'UTF-16' » (or 'UTF-16le' or
> 'UTF-16be') when you create the database.
>
>   ---> Drake Wilson
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to