Change characters in logs?
#1

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.
Reply
#2

The charset doesn't support it probably, use
Code:
file -i file.log
to see the charset

Code:
iconv -l
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.
Reply
#3

Quote:
Originally Posted by Kaperstone
View Post
The charset doesn't support it probably, use
Code:
file -i file.log
to see the charset

Code:
iconv -l
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);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)