Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I quote a UTF-8 String Literal in Sqlite3

I'm looking to encode and store Unicode in a Sqlite database. Is there any way to raw encode a UTF-8 (unicode) string literal in a sql query.

I'm looking for something similar to java where I can toss a \u00E9 into a string and have it automagically upconvert to Unicode.

like image 513
Sean Madden Avatar asked Aug 09 '10 21:08

Sean Madden


1 Answers

What language are you using? SQLite handles Unicode just fine, creating the literals in your hosting language is less obvious.

$ sqlite3 junk.sqlite
SQLite version 3.6.22
sqlite> create table names (id integer primary key, name string);
sqlite> insert into names values (null, 
    'î℉ yõù g𐌹ѷЄ ΣϘГくטƏ UTF-8, it stores it');
sqlite> select * from names;
1|î℉ yõù g𐌹ѷЄ ΣϘГくטƏ UTF-8, it stores it
like image 176
msw Avatar answered Sep 21 '22 08:09

msw