oscar-broman / strlib

String functions for SA-MP Pawn scripting.
50 stars 16 forks source link

ut8decode return 1 character less #21

Open Walter-Correa opened 4 years ago

Walter-Correa commented 4 years ago

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)

oscar-broman commented 4 years ago

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?

Walter-Correa commented 4 years ago

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?

oscar-broman commented 4 years ago

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?

Walter-Correa commented 4 years ago

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:


In settings for ASP.NET applications:

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

oscar-broman commented 4 years ago

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

Walter-Correa commented 4 years ago

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