SA-MP Forums Archive
UTF8 decode/encode plugin - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: UTF8 decode/encode plugin (/showthread.php?tid=412889)



UTF8 decode/encode plugin - Misiur - 03.02.2013

I don't know if there is any more effective method of correctly displaying utf8 characters, but for now I'm using https://sampforum.blast.hk/showthread.php?tid=223944 plugin.

pawn Код:
main() {
    new str[32];
    UTF8_Encode("żołw", str, sizeof str);
    UTF8_Decode(str, str, sizeof str);
    printf(str);
    printf("żуłw");
}
Prints "żуłw" and some bushes as expected. Now when I want to shorten the code a little ("Е»ГіЕ‚w" is utf8 encoded "żуłw"):
pawn Код:
main() {
    new str[32];
    UTF8_Decode("Е»ГіЕ‚w", str, sizeof(str));
    printf(str);
}
Bam! Server crash.

The pwn document is encoded in _ascii_ - only this way I get the correct characters to show up. Is there some other way of handling nonascii charsets?