Change characters in logs? - 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)
+---- Forum: Discussion (
https://sampforum.blast.hk/forumdisplay.php?fid=84)
+---- Thread: Change characters in logs? (
/showthread.php?tid=647427)
Change characters in logs? -
MustafaKemalAtaturk - 05.01.2018
When i was make the log system with sa-mp file system, my logs would be problems about Turkish characters. If anyone use Turkish character in the server, my log file sucks. Print like "ю" etc. characters. How can i fix that?
And absolutely sorry for my bad English.
Re: Change characters in logs? -
Kaperstone - 06.01.2018
The charset doesn't support it probably, use
to see the charset
To list all the available charsets
Code:
iconv -f ISO-8859-1 -t UTF-8//TRANSLIT input.file -o out.file
To set the charset.
whereas,-f CHARSET if "from charset" and -t CHARSET is "to charset"
`TRANSLIT` means that it will try to convert the file to another character, in case of a fail, it will replace it with a similar looking character that it can convert to.
Re: Change characters in logs? -
MustafaKemalAtaturk - 06.01.2018
Quote:
Originally Posted by Kaperstone
The charset doesn't support it probably, use
to see the charset
To list all the available charsets
Code:
iconv -f ISO-8859-1 -t UTF-8//TRANSLIT input.file -o out.file
To set the charset.
whereas,-f CHARSET if "from charset" and -t CHARSET is "to charset"
`TRANSLIT` means that it will try to convert the file to another character, in case of a fail, it will replace it with a similar looking character that it can convert to.
|
I'm sorry but i cant understand :\ I'll paste my log system codes (from this forum), can you help me?
Code:
stock fileLog(file[], string[])
{
new time[6];
gettime(time[0], time[1], time[2]);
getdate(time[3], time[4], time[5]);
new timestr[32], data[128];
format(timestr,32,"[%02d.%02d.%02d|%02d:%02d] ",time[5],time[4], time[3], time[0], time[1]);
format(data, sizeof(data), "%s%s\r\n",timestr,string);
new File:hFile, thefile[32];
format(thefile, sizeof(thefile), "/logs/%s.log", file);
hFile = fopen(thefile, io_append);
fwrite(hFile, data);
fclose(hFile);
}