Logic Machine Forum
Character set mysql update - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Character set mysql update (/showthread.php?tid=5131)



Character set mysql update - gjniewenhuijse - 04.12.2023

Hello, i try to update a mysql table with character set  utf8_general_ci

Here my code

Code:
require('luasql.mysql')
env = luasql.mysql()
dbcon = env:connect('xxx','xxx', 'xxx', 'xxx', '3306')
if dbcon then
    isql = "update table set locatie='Résidentie Bâte Kolères' where villanr = 1"
    log(isql)
    cursor = dbcon:execute(isql)
    dbcon:close()
    env:close()
end
 

 But after updating the table, my locatie column is displayed as: Résidentie Bâte Koleères

How to do a correct update? or do i change my character set of the table?


RE: Character set mysql update - admin - 05.12.2023

Try executing SET NAMES utf8 query before doing any other queries.


RE: Character set mysql update - gjniewenhuijse - 05.12.2023

(05.12.2023, 08:29)admin Wrote: Try executing SET NAMES utf8 query before doing any other queries.

Great, that works