katursis / Pawn.CMD

🚀 Plugin-powered command processor for SA:MP server
MIT License
119 stars 13 forks source link

Alias and ISO 8859-1 encoding: "ToLower: bad conversion", "ToLower: wstring_convert::from_bytes" #23

Closed Autorojo closed 4 years ago

Autorojo commented 4 years ago

I'm getting errors in command aliases since 3.3.0.

For example, this code:

CMD:test(playerid, params[])
{
    SendClientMessage(playerid, -1, "OK");
    return 1;
}

alias:test("tést", "teñst")

Works fine on a gamemode/filterscript with UTF-8 encoding. But in a ISO 8859-1 encoding gamemode it returns these errors:

And the callback OnPlayerCommandReceived sometimes cuts the cmd[] string. So, if the command it's something like /hellowórld, the callback returns a cmd[] string like hellow.

I tried using LocaleName = "es_ES.ISO8859-1" in pawncmd.cfg but it does nothing.

katursis commented 4 years ago

Works fine on a gamemode/filterscript with UTF-8 encoding. But in a ISO 8859-1 encoding gamemode it returns these errors

Why can't you just use UTF-8 encoding?

Autorojo commented 4 years ago

Works fine on a gamemode/filterscript with UTF-8 encoding. But in a ISO 8859-1 encoding gamemode it returns these errors

Why can't you just use UTF-8 encoding?

Because all the acute accents, tildes, etc, brokes in a UTF-8 encoded gamemode.

For example, this code:

public OnPlayerSpawn(playerid)
{
    SendClientMessage(playerid, -1, "á é í ó ú ñ Á É Í Ó Ú Ñ");
    return 1;
}

Looks like this:

Example image

I think that's because of the OS options of all native spanish speakers. See this and this.

katursis commented 4 years ago

Try that, please.

pawncmd.zip (commit https://github.com/urShadow/Pawn.CMD/commit/01a9ae4219e74302853c74fdc9e4723421530f67)

Autorojo commented 4 years ago

Try that, please.

pawncmd.zip (commit 01a9ae4)

That works perfect with the properly LocaleName configuration in pawncmd.cfg.

It seems to be solved. Great job!

katursis commented 4 years ago

Fixed.

https://github.com/urShadow/Pawn.CMD/releases/tag/3.3.3