On 1 Jan 2012, at 7:40pm, Zbigniew wrote: > Reading the contents of the blog > http://milky.manishsinha.net/2009/03/30/sqlite-with-c/ tried to follow > the tips to access SQLite database from C, but there's a problem: > actually database should keep UTF-8 encoded data. No problem, when > one's using LATIN1 - but I tried LATIN2 strings, and they were > inserted just "as they were". > > Not sure: did I miss something in SQLite docs (any transcoding > function available?) - or one has to transcode all the strings before > insertion on his own, e.g. using iconv()?
You cannot correctly use LATIN2 or LATIN1 with SQLite. SQLite handles only UTF-8 and UTF-16 correctly. Do anything else and you're on your own -- some stuff works, some doesn't. In other words, your last question is right: if your original text isn't UTF then you must create or use a library routine to convert it to UTF. Also note that some of the source code on that page hasn't been corrected correctly. Some editor he's using has changed apostrophes (') to directed quotes (‘), (’). I think he's spotted some but not others. Directed quotes will not work correctly. It is correct to use apostrophes for quoting text strings. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users