# HG changeset patch # User Kim Alvefur # Date 1383043429 -3600 # Node ID ea6a3adb6a697ebef6c2733d163a31646f44522a # Parent f3e408ae59a644a58d4d38e1dee31dde90ed8246 util.sql: Check what encoding SQLite3 uses diff -r f3e408ae59a6 -r ea6a3adb6a69 util/sql.lua --- a/util/sql.lua Tue Oct 29 11:42:55 2013 +0100 +++ b/util/sql.lua Tue Oct 29 11:43:49 2013 +0100 @@ -290,8 +290,14 @@ return success; end function engine:set_encoding() -- to UTF-8 - if self.params.driver == "SQLite3" then return end local driver = self.params.driver; + if driver == "SQLite3" then + return self:transaction(function() + if self:select"PRAGMA encoding;"()[1] == "UTF-8" then + self.charset = "utf8"; + end + end); + end local set_names_query = "SET NAMES '%s';" local charset = "utf8"; if driver == "MySQL" then