open.mp
open.mp copied to clipboard
Bug with Cyrillic alphabet flips every 4 bytes in format() and %q
trafficstars
In format() function %q breaks the Cyrillic alphabet, flips every 4 bytes. If you add an ASCII symbol first, for example, a space, the problem is solved.
There is no such problem with %q in standard SA:MP server
{ // %q
new string[100];
new name[] = "Привет мир";
format(string, sizeof(string), "Test string '%q'", name);
printf(string);
}
{ // space + %q
new string[100];
new name[] = " Привет мир";
format(string, sizeof(string), "Test string '%q'", name);
printf(string);
}
{ // %s
new string[100];
new name[] = "Привет мир";
format(string, sizeof(string), "Test string '%s'", name);
printf(string);
}
OUTPUT 2025/07/25 17:19:31 [Info] Test string 'вирПм те' 2025/07/25 17:19:31 [Info] Test string ' Привет мир' 2025/07/25 17:19:31 [Info] Test string 'Привет мир'