aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/sql.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/util/sql.lua b/util/sql.lua
index 4e63bed7..8c870b64 100644
--- a/util/sql.lua
+++ b/util/sql.lua
@@ -290,8 +290,14 @@ function engine:_create_table(table)
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