oscar-broman / strlib

String functions for SA-MP Pawn scripting.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ut8decode return 1 character less

Walter-Correa opened this issue · comments

The sent word: Palhaço
Comes: Palhaço

After ut8decode: Palhaç

If sent: Palhaço de mérda
Comes: Palhaço de mérda

After ut8decode: Palhaço de mér (2 chars less)

utf8 strings are not supported by any Pawn functions and only meant for special things such as binary encoding.

What is it you're trying to do?

utf8 strings are not supported by any Pawn functions and only meant for special things such as binary encoding.

What is it you're trying to do?

I have a remote rcon ban/unban/kick/say system via admin ucp. The serve language is brazilian, so any characters like ãéçô sent via ucp need to be decoded.
Any solution?

How is this information read into Pawn? Could you simply not just skip utf8 and encode it in the character sets used by Brazilians?

Could you go to your Windows settings and see which character set you use?

What programming language does your UCP use?

How is this information read into Pawn? Could you simply not just skip utf8 and encode it in the character sets used by Brazilians?

public OnRconCommand(cmd[])
{
	new RParams[300],RCMD[40];
	sscanf(cmd, "s[40]s[300]", RCMD, RParams);

	if(IsSameStr(RCMD,"ucpsay"))
	{
		new text[256],admin[25];
		if(!sscanf(RParams, "s[25]s[300]",admin,text))
		{
			format(ChatString, sizeof(ChatString), "[ADMIN]: %s: {FFFFFF}%s",admin,text);
			foreach(new i : Player) SendClientMessage(i, AMARELO, ChatString);
			return 1;
		}
		return 1;
	}
	return 0;
}

What programming language does your UCP use?

Language: C#
Pages Charset: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta charset="utf-8" />

In settings for ASP.NET applications:

Request encoding: utf-8
Response encoding: utf-8
File encoding: Windows-1252

With that Rcon command, if you simply do printf("text: %s", text); what will that show in the server log?

Rcon: Palhaço de mérda
Printf: Palhaço de mérda