I'm replying to this topic as my issue is directly related to the modified script released by TweaK.
The aim of using MySQL for Utime is to use it on a website and get some quick info about some players and stuff.
The stock UTime addon does not save the Steam-ID, nor the current name of the player. This addon does that, which is a nice feature that I need.
However, an issue with the names is that they are not being saved in UTF-8, so german umlauts are being destroyed and all other characters that many people use are destroyed, too.
I've already changed the encoding in my MySQL table to utf8_unicode_ci, but the names are still being butchered and I suspect lua to be doing that.
Is there a way to get the script to input UTF-8 encoded characters?
As an example:
Jünger² Gabor
is being saved as
Jünger² Gabor
This is an excerpt of the update-query:
query( "UPDATE utime SET totaltime = " .. math.floor( ply:GetUTimeTotalTime() ) .. ", steamid = '" ..
ply:SteamID() .. "', playername = '" .. db:escape( ply:Nick() ) .. "' WHERE player = " ..
ply:UniqueID() .. ";", function() end )
-------------------------------------
I did it!
The thing that was missing was "SET NAMES 'utf8';" as the first query before any other queries. Also the playername row must be encoded in utf8_unicode_ci to allow UTF-8 encoded entries.
Here is how to install it:
I already have a UTime MySQL table with entries
1. Open your table structure via phpmyadmin
2. Edit the row "playername"
3. Change the collation to "utf8_unicode_ci"
If you do not have phpmyadmin and can only use SQL queries, use this one:
USE <database>;
ALTER TABLE `utime` CHANGE `playername` `playername` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ;
and replace "<database>" with the name of your database where utime is installed.
This is the first time I install UTime with MySQL
1. You do not have to change anything, the script automatically constructs the playernames table with UTF-8 encoding
You find the modified scripts in an attachment to this post which you can only see when being logged in.