Raised This Month: $32 Target: $400
 8% 

Solved Doesn't SQL_ReadResult support UTF8?


Post New Thread Reply   
 
Thread Tools Display Modes
peaces
Junior Member
Join Date: May 2008
Old 10-28-2021 , 01:53   Re: Doesn't SQL_ReadResult support UTF8?
Reply With Quote #11

Solution found, not tested
Code:
SQL_FieldNameToNum
Returns the number of a named column, or -1 if not found.

native SQL_FieldNameToNum(Handle:query, const name[]);
peaces is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-28-2021 , 20:45   Re: Doesn't SQL_ReadResult support UTF8?
Reply With Quote #12

But that's just getting the column number when you give it the column name, not reading the column value.

So a table with columns : a, b, c

SQL_FieldNameToNum( query , "a" ) would return 0 , b = 1 , etc.
__________________
Bugsy is offline
peaces
Junior Member
Join Date: May 2008
Old 11-03-2021 , 08:16   Re: Doesn't SQL_ReadResult support UTF8?
Reply With Quote #13

Currently reading UTF-8 messages from the database ~ the problem has not been resolved
peaces is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-03-2021 , 19:34   Re: Doesn't SQL_ReadResult support UTF8?
Reply With Quote #14

Can you provide expected versus actual output?
__________________
Bugsy is offline
peaces
Junior Member
Join Date: May 2008
Old 11-17-2021 , 07:15   Re: Doesn't SQL_ReadResult support UTF8?
Reply With Quote #15

Quote:
Originally Posted by Bugsy View Post
Can you provide expected versus actual output?


If the NICK character of the database is UTF-8, it will not be displayed normally
Code:
new str[32]
			SQL_ReadResult(query, 0, str, 31)
	
			if(get_pcvar_num(pi_show_who) == 1)
			{
				new players[32], playersnum
				get_players(players, playersnum, "ch")
				for(new i = 0; i < playersnum; i++)
				{
					new player = players[i]
					if(is_user_admin(player))
					{
						if(get_pcvar_num(pi_hudmsg) == 0)
						{
							client_print(player, print_chat, "%L", LANG_PLAYER, "JOIN_MSG", name, str)
						}
						else
						{
							new message[192]
							format(message, 191, "%L", LANG_PLAYER, "JOIN_HUDMSG", name , str)
							set_hudmessage(0, 255, 0, 0.05, 0.30, 0, 6.0, 5.0 , 0.5, 0.15, -1)
							ShowSyncHudMsg(player, MyMsgSync, "%s", message)
						}
					}
				}
			}

Last edited by peaces; 11-17-2021 at 07:18.
peaces is offline
peaces
Junior Member
Join Date: May 2008
Old 04-09-2023 , 06:05   Re: Doesn't SQL_ReadResult support UTF8?
Reply With Quote #16

Solved after adding this column
UTF-8 characters
Quote:
new query[512]
format(query, 511, "SELECT nick FROM `%s` WHERE `authid` = '%s' ORDER BY uses DESC LIMIT 1", g_table, steamid)

new data[1]
data[0] = id
SQL_SetCharset(g_SqlX, "utf8")
SQL_ThreadQuery(g_SqlX, "_join_msg", query, data, 1)
return PLUGIN_CONTINUE
Attached Thumbnails
Click image for larger version

Name:	20230408184205_1.jpg
Views:	52
Size:	21.9 KB
ID:	200182  

Last edited by peaces; 04-09-2023 at 06:21.
peaces is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:23.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode