SA-MP Forums Archive
Problem with character encoding - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with character encoding (/showthread.php?tid=672308)



Problem with character encoding - Davi52 - 05.02.2020

Hey! Im getting problems with loading datas from MySQL. So on the MySQL table the text is : "Életálom",but as I get it with the query, and write it out with SendClientMessage(tried with dialog), it sends me:"Életálom".
I tried this
Code:
mysql_set_charset("utf8_hungarian_ci", sql);
mysql_query (sql, "SET NAMES utf8_hungarian_ci");
to put it after connection, but it's not working. Ensured that the sql table column encoding is "utf8_hungarian_ci". Any ideas how to fix this? Thanks :O


Re: Problem with character encoding - FireBoy89 - 05.02.2020

SAMP doesn't support UTF8 so you can't use utf8 encoding in SendClientMessage sadly. (SAMP only supports ASCII encoding at the moment)


Re: Problem with character encoding - Davi52 - 06.02.2020

But the funny is that if I write some hungarian character directly in SendClientMess function, it's ok, it has no problems, only if I receive them from sql. Any ideas pls?


Re: Problem with character encoding - RoboN1X - 07.02.2020

Pretty sure you wanted to use latin2_hungarian_ci instead.

Quote:
Originally Posted by FireBoy89
View Post
(SAMP only supports ASCII encoding at the moment)
"SAMP only supports ASCII encoding" is misleading, what you write in SendClientMessage codes will follow your pawn compiler charset setting. How the message would display in the client will follow the player system / language setting, otherwise a wrong byte character or "?" mark would show for them.

If you meant that ASCII is only supported for "char"-array, then it is limited to PAWN only as SA-MP functions do not provide use for packed strings at all.