You are here: Big Brother Bot ForumGeneral CategoryGeneral DiscussionThe impossible is nothing or B3 and Cyrillic
Pages: [1]   Go Down
  Print  
Author Topic: The impossible is nothing or B3 and Cyrillic  (Read 1200 times) Bookmark and Share
Beta Testers
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: cod4
Posts: 68
Offline Offline
WWW
« on: August 15, 2011, 03:56:55 AM »

Hi all , I would like to tell you how I made b3 understand the Cyrillic alphabet
I'm using b3 v 1.7.0b

Attention! This only works with cod4 when B3 displays messages.
Work with Echelon, chatlogger plugin with loggining in database doesn't test.


1. in b3/parsers/cod.py

find this 3 lines
Code:
339        return b3.events.Event(b3.events.EVT_CLIENT_SAY, data, client)
361        return b3.events.Event(b3.events.EVT_CLIENT_TEAM_SAY, data, client)
382        return b3.events.Event(b3.events.EVT_CLIENT_PRIVATE_SAY, data, client, tclient)

and replace on this

Code:
339        return b3.events.Event(b3.events.EVT_CLIENT_SAY, data.decode('cp1251'), client)
361        return b3.events.Event(b3.events.EVT_CLIENT_TEAM_SAY, data.decode('cp1251'), client)
382        return b3.events.Event(b3.events.EVT_CLIENT_PRIVATE_SAY, data.decode('cp1251'), client, tclient)

2. in b3/parsers/q3a/rcon.py

find this 2 lines
Code:
120        writeables[0].send(self.qserversendstring % data)
166        writeables[0].send(self.rconsendstring % (self.password, data))

and replace on
Code:
120        writeables[0].send(self.qserversendstring % unicode(data).encode('cp1251','replace'))
166        writeables[0].send(self.rconsendstring % (self.password, unicode(data).encode('cp1251','replace')))


3. Save your translate config as UTF-8 without BOM

As example I'm added  in attach my modified plugin pingwatch
Logged

Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3483
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #1 on: August 15, 2011, 10:47:24 AM »

Thanks a lot for sharing this  Wink
Logged

Jr. Member
**
OS: Windows
Type: Owner dedicated server(s)
Gameservers: BFBC2, CoDBO, BF3
Posts: 23
Offline Offline
WWW
« Reply #2 on: September 01, 2011, 07:21:39 AM »

It would be great if all this is to make friends with the echelon
Logged
Jr. Member
**
OS: Windows
Type: Owner dedicated server(s)
Gameservers: BFBC2, CoDBO, BF3
Posts: 23
Offline Offline
WWW
« Reply #3 on: September 01, 2011, 07:27:57 AM »

Courgette

probably somewhere here in order to be correct chatlog back normal encoding

Code:
216   Initialize plugin settings
    """
   
    # listen for client events
    self.registerEvent(b3.events.EVT_CLIENT_SAY)
    self.registerEvent(b3.events.EVT_CLIENT_TEAM_SAY)
    self.registerEvent(b3.events.EVT_CLIENT_PRIVATE_SAY)


   

  def onEvent(self, event):
    """\
    Handle intercepted events
    """
    if not event.client or event.client.cid == None or len(event.data) <= 0:
      return
   
    if event.type == b3.events.EVT_CLIENT_SAY:
      chat = ChatData(self, event)
      chat._table = self._db_table
      chat.save()
    if event.type == b3.events.EVT_CLIENT_TEAM_SAY:
      chat = TeamChatData(self, event)
      chat._table = self._db_table
      chat.save()
    if event.type == b3.events.EVT_CLIENT_PRIVATE_SAY:
      chat = PrivateChatData(self, event)
      chat._table = self._db_table
      chat.save()............
Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3483
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #4 on: September 01, 2011, 07:42:23 AM »

I have no way to test whether or not changes I make to have Cyrillic stuff working does work and/or breaks classic ASCII stuff.

As such I will no longer try to make Cyrillic work (sorry) in order to avoid failures such as our latest B3 1.7.0 release which lived only a few hours because of another failed Cyrillic attempt.
Logged

Newbie
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: cod4
Posts: 2
Offline Offline
« Reply #5 on: September 12, 2011, 04:56:28 AM »

So the problem is not solved with the Cyrillic? ( Huh?? HuhHuh? ? HuhHuh? )
Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3483
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #6 on: September 12, 2011, 12:32:32 PM »

So the problem is not solved with the Cyrillic? ( Huh?? HuhHuh? ? HuhHuh? )

no idea, as I said I cannot test the Cyrillic issue properly due to not running a Russian game server and not running a Russian game etc. I've wasted too much time trying to blindly adapt B3 to Cyrillic and ending up breaking stuff that was working fine before.

Any patch from a talented Russian developer is welcome. But don't expect me to work on that issue, sorry.
Logged

[ www.xlrstats.com ]
Project Lead
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: CoD, CoD2, CoD5, UrT
Posts: 2022
Offline Offline
WWW
Support Specialty: B3-Core, CoD/UrT/WoP/ETPro parsers, Plugin development
« Reply #7 on: September 19, 2011, 10:47:02 AM »

For developers: I prepared a new branch in my github: http://bit.ly/oVngUF

If you want to alter server rcon encoding/decoding for testing you can use this version (for CoD servers only).

You will need to add to your b3.xml a setting called 'encoding' in the 'server' section holding the proper encoding.

Feel free to share your experiences.
Logged

Jr. Member
**
OS: Linux
Type: Owner dedicated server(s)
Gameservers: COD4
Posts: 13
Offline Offline
WWW
« Reply #8 on: November 21, 2011, 11:41:36 AM »

The issue is about writing into the game. For example Russian client of the COD doesn't support German symbols nativly (I think becouse of using 1251 instead of UTF-8)

And you don't need Russian server, you only need Russian Client to check
« Last Edit: November 21, 2011, 12:17:52 PM by DragonZX » Logged
Tags:
Pages: [1]   Go Up
  Print  
 
Jump to:  


Rate this page +1 at Google Search


SimplePortal 2.3.1 © 2008-2009, SimplePortal