problem with special chars at stats.log

Post anything to do with editing Nexuiz here. Whether its problems you've had, questions, or if you just want to show off your work.

Moderators: Nexuiz Moderators, Moderators

problem with special chars at stats.log

Postby ZyanKLee » Sun Jun 15, 2008 7:08 pm

hey, I have some problems parsing the stats.log regarding special chars and/or charset conversion:

logfile looks like this - for example:

:player:-666:0:1149:13:ZyanKLee
:player:30:23:1139:4:��� ��
�:player:28:30:1133:12:^4d^1r^0@^1c^4o^7

first problem is all those special chars. second problem is breaking of line beginning through one of those chars that is interpreted as a linefeed.

someone knows how to work around this?
ZyanKLee
Alien
 
Posts: 151
Joined: Sun Feb 18, 2007 8:58 pm
Location: Germany

Postby :) » Mon Jun 16, 2008 2:25 am

Convert the characters in player names to bytes. They will then correspond to this array:
Code: Select all
' ', '#', '#', '#', '#', '.', '#', '#',
'#', 9, 10, '#', ' ', 13, '.', '.',
'[', ']', '0', '1', '2', '3', '4', '5',
'6', '7', '8', '9', '.', '<', '=', '>',
' ', '!', '"', '#', '$', '%', '&', '\'',
'(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', ':', ';', '<', '=', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', '{', '|', '}', '~', '<',
'<', '=', '>', '#', '#', '.', '#', '#',
'#', '#', ' ', '#', ' ', '>', '.', '.',
'[', ']', '0', '1', '2', '3', '4', '5',
'6', '7', '8', '9', '.', '<', '=', '>',
' ', '!', '"', '#', '$', '%', '&', '\'',
'(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', ':', ';', '<', '=', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', '{', '|', '}', '~', '<'
:)
Keyboard killer
 
Posts: 590
Joined: Tue Feb 28, 2006 9:09 pm

Postby ZyanKLee » Mon Jun 16, 2008 10:39 am

many thanks to you. this helped me really a lot.

now the lines look like this:

:player:-666:0:1149:13:ZyanKLee
:player:30:23:1139:4:C/B?B=C/B?B=C/B?B=C/B?B=C/B?B=10C/B?B=
:player:28:30:1133:12:^4d^1r^0@^1c^4o^7


first and last lines are (and where) easy - last one is dr@co with color-codes. but what about the playername in the middle line?

"C/B?B=C/B?B=C/B?B=C/B?B=C/B?B=10C/B?B="

perhaps my code is not optimal:

Code: Select all
#!/usr/bin/perl

$string=':player:-666:0:1149:13:ZyanKLee
:player:30:23:1139:4:��� ��
�:player:28:30:1133:12:^4d^1r^0@^1c^4o^7';

@string = split ":", $string;
foreach $str (@string) {
        chomp $str;
        @array=split / */, $str;
        @chararray = ( ' ', '#', '#', '#', '#', '.', '#', '#','#', 9, 10, '#', ' ', 13, '.', '.','[', ']', '0', '1', '2', '3', '4', '5','6', '7', '8', '9', '.', '<', '=', '>',' ', '!', '"', '#', '$', '%', '&', '\'','(', ')', '*', '+', ',', '-', '.', '/','0', '1', '2', '3', '4', '5', '6', '7','8', '9', ':', ';', '<', '=', '>', '?','@', 'A', 'B', 'C', 'D', 'E', 'F', 'G','H', 'I', 'J', 'K', 'L', 'M', 'N', 'O','P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W','X', 'Y', 'Z', '[', '\\', ']', '^', '_','`', 'a', 'b', 'c', 'd', 'e', 'f', 'g','h', 'i', 'j', 'k', 'l', 'm', 'n', 'o','p', 'q', 'r', 's', 't', 'u', 'v', 'w','x', 'y', 'z', '{', '|', '}', '~', '<','<', '=', '>', '#', '#', '.', '#', '#','#', '#', ' ', '#', ' ', '>', '.', '.','[', ']', '0', '1', '2', '3', '4', '5','6', '7', '8', '9', '.', '<', '=', '>',' ', '!', '"', '#', '$', '%', '&', '\'','(', ')', '*', '+', ',', '-', '.', '/','0', '1', '2', '3', '4', '5', '6', '7','8', '9', ':', ';', '<', '=', '>', '?','@', 'A', 'B', 'C', 'D', 'E', 'F', 'G','H', 'I', 'J', 'K', 'L', 'M', 'N', 'O','P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W','X', 'Y', 'Z', '[', '\\', ']', '^', '_','`', 'a', 'b', 'c', 'd', 'e', 'f', 'g','h', 'i', 'j', 'k', 'l', 'm', 'n', 'o','p', 'q', 'r', 's', 't', 'u', 'v', 'w','x', 'y', 'z', '{', '|', '}', '~', '<' );

        foreach $char (@array) {
                $ordchar = ord $char;
                print $chararray[$ordchar];
        }
        print "\n";
}
ZyanKLee
Alien
 
Posts: 151
Joined: Sun Feb 18, 2007 8:58 pm
Location: Germany

Postby KadaverJack » Mon Jun 16, 2008 12:00 pm

ZyanKLee wrote:first and last lines are (and where) easy - last one is dr@co with color-codes. but what about the playername in the middle line?

Did you copy-paste your test data? Since i can't find any problem in your code i guess you did... Copying might screw up the characters (due to charset conversions). You should check with a hexeditor if the bytes really match those in your server log.
KadaverJack
Site admin and forum addon
 
Posts: 1102
Joined: Tue Feb 28, 2006 9:42 pm

Postby ZyanKLee » Mon Jun 16, 2008 2:52 pm

yeah, that may be the reason - perhaps I just add this to the real parser and have a look at what comes out of it.


[EDIT]
It works, thanks a lot for your support.
ZyanKLee
Alien
 
Posts: 151
Joined: Sun Feb 18, 2007 8:58 pm
Location: Germany


Return to Nexuiz - Editing

Who is online

Users browsing this forum: No registered users and 1 guest

cron