Omnimaga

General Discussion => Technology and Development => Computer Programming => Topic started by: Sorunome on December 16, 2012, 04:03:00 am

Title: Lua mysql problem
Post by: Sorunome on December 16, 2012, 04:03:00 am
Hey, i encountered a problem with lua and mysql
a huge problem, with unicode characters.
On mysql everything is set to utf8, seriousley everything, but when carching 'em through lua they get '?'
and sending SET NAMES utf8; craches
here's my code:
Code: [Select]
env = assert(luasql.mysql());
con = assert(env:connect("<username>","<database>","<passwd>", "localhost"));
--conn:execute("SET NAMES 'utf8';");
cur = assert(con:execute("SELECT * FROM axebotcommands WHERE LOWER(plaintoken) LIKE '%"..args.."%';"));
--cur = conn:execute("SHOW VARIABLES LIKE 'character_set%';");
row = {};
results = {};
for i=1, cur:numrows() do
row = cur:fetch(row, "a"); --a
table.insert(results,row["token"]..": "..row["message"])
end;
cur:close();
con:close();
env:close();
it would be epic if somebody could help me.