Notice: Undefined index: HTTP_ACCEPT_LANGUAGE in /var/www/sa-mp.com/forum/showthread.php on line 25
Change characters in logs? - SA-MP Forums
SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Discussion

Reply
 
Thread Tools Display Modes
Old 05/01/2018, 12:41 AM   #1
MustafaKemalAtaturk
Little Clucker
 
MustafaKemalAtaturk's Avatar
 
Join Date: Mar 2015
Location: Turkey
Posts: 12
Reputation: 0
Default Change characters in logs?

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.
MustafaKemalAtaturk is offline   Reply With Quote
Old 06/01/2018, 06:57 AM   #2
Kaperstone
Banned
 
Join Date: May 2011
Location: Russia
Posts: 3,347
Reputation: 824
Default Re: Change characters in logs?

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.
Kaperstone is offline   Reply With Quote
Old 06/01/2018, 09:47 AM   #3
MustafaKemalAtaturk
Little Clucker
 
MustafaKemalAtaturk's Avatar
 
Join Date: Mar 2015
Location: Turkey
Posts: 12
Reputation: 0
Default Re: Change characters in logs?

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);
}
MustafaKemalAtaturk is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting all characters one by one Don_Cage Scripting Help 3 25/07/2014 05:22 PM
Which is the best way to save chat logs/command logs, etc? BlackAnt Scripting Help 6 27/02/2014 09:09 PM
Replace a car without moving, change speed, change the angle Justinlol Help Archive 5 14/08/2011 02:41 PM
Little stupid question, but how to change the topic title? It doesn't change when I edit the first post Mean Everything and Nothing 6 29/01/2011 03:29 PM
[JUST ASKING]Characters Mac_Rulez Help Archive 8 07/10/2009 12:33 AM


All times are GMT. The time now is 03:07 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.