startersclan / docker-hlstatsxce-daemon

Dockerized HLStatsX:CE perl daemon 🐳
GNU General Public License v3.0
4 stars 1 forks source link

Bad player names can cause it to crash #20

Closed Synkstar closed 1 year ago

Synkstar commented 1 year ago

daemon_1  | Unable to execute query:
daemon_1  |
daemon_1  |                     SELECT
daemon_1  |                             playerId
daemon_1  |                     FROM
daemon_1  |                             hlstats_PlayerNames
daemon_1  |                     WHERE
daemon_1  |                             playerId = 45
daemon_1  |                             AND name ='ゴMr.B🖤ゴ
daemon_1  |
daemon_1  | Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb3_general_ci,COERCIBLE) for operation '='
leojonathanoh commented 1 year ago

It does. There are several bugs in the perl code, that need manual remedy. I needed to do quite a bit of fixing in my personal fork that is very messy. Hope you know perl enough to do some fixes :)

As for the error above, I believe you need to change the convert all collations in the DB tables to utf8mb4_unicode_ci.

leojonathanoh commented 1 year ago

Specifically, in install.sql, you need to replace all instances of DEFAULT CHARSET=utf8 with DEFAULT CHARSET=utf8mb4 and DEFAULT COLLATE=utf8 with DEFAULT COLLATE=utf8mb4_unicode_ci. This allow supporting special characters / emoji in player names all other text columns of DB tables. See https://stackoverflow.com/a/50264108 for more information. Hope it helps!

leojonathanoh commented 1 year ago

I really wish I could support the community with some of my personal modifications, but it really takes up a bit of time to clean up my code. In the meantime, there are some forks which might have fixed minor issues e.g. https://github.com/NomisCZ/hlstatsx-community-edition. :P

leojonathanoh commented 1 year ago

Hey @Synkstar, i've added fixes from my personal fork that fixed this error for me in the past, see the readme again. Hope it works for you!