Author Topic: Lua mysql problem  (Read 2274 times)

0 Members and 1 Guest are viewing this topic.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Lua mysql problem
« 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.

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!