katursis / Pawn.CMD

🚀 Plugin-powered command processor for SA:MP server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Autorojo opened this issue · comments

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:

  • "ToLower: bad conversion" (Windows)
  • "ToLower: wstring_convert::from_bytes" (Linux)

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.

commented

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?

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.

commented

Try that, please.

pawncmd.zip (commit 01a9ae4)

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!