thankyou
Donate to the B3 fund!

"even a small donation helps!"
Donate with PayPal!

Author Topic: The impossible is nothing or B3 and Cyrillic  (Read 6577 times)

Offline -real-

  • Full Member
  • ***
  • Posts: 66
The impossible is nothing or B3 and Cyrillic
« on: August 15, 2011, 01:56:55 PM »
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: [Select]
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: [Select]
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: [Select]
120        writeables[0].send(self.qserversendstring % data)
166        writeables[0].send(self.rconsendstring % (self.password, data))

and replace on
Code: [Select]
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


[attachment deleted by maintenance]

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4882
    • Github repository
Re: The impossible is nothing or B3 and Cyrillic
« Reply #1 on: August 15, 2011, 08:47:24 PM »
Thanks a lot for sharing this  ;)

Offline gazgaz

  • Jr. Member
  • **
  • Posts: 23
    • Brothers In Games
Re: The impossible is nothing or B3 and Cyrillic
« Reply #2 on: September 01, 2011, 05:21:39 PM »
It would be great if all this is to make friends with the echelon

Offline gazgaz

  • Jr. Member
  • **
  • Posts: 23
    • Brothers In Games
Re: The impossible is nothing or B3 and Cyrillic
« Reply #3 on: September 01, 2011, 05:27:57 PM »
Courgette

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

Code: [Select]
 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()............

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4882
    • Github repository
Re: The impossible is nothing or B3 and Cyrillic
« Reply #4 on: September 01, 2011, 05:42:23 PM »
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.

Offline yogi

  • Newbie
  • *
  • Posts: 2
Re: The impossible is nothing or B3 and Cyrillic
« Reply #5 on: September 12, 2011, 02:56:28 PM »
So the problem is not solved with the Cyrillic? ( ????? ??????? ? ??????? )

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4882
    • Github repository
Re: The impossible is nothing or B3 and Cyrillic
« Reply #6 on: September 12, 2011, 10:32:32 PM »
So the problem is not solved with the Cyrillic? ( ????? ??????? ? ??????? )

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.

Offline xlr8or

  • [ www.xlrstats.com ]
  • Project Lead
  • Hero Member
  • *
  • Posts: 2057
    • The Art of Tactical Gaming
Re: The impossible is nothing or B3 and Cyrillic
« Reply #7 on: September 19, 2011, 08:47:02 PM »
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.

Offline DragonZX

  • Jr. Member
  • **
  • Posts: 16
    • Star's Alliance
Re: The impossible is nothing or B3 and Cyrillic
« Reply #8 on: November 21, 2011, 08:41:36 PM »
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, 09:17:52 PM by DragonZX »

Offline Beliy.IV

  • Jr. Member
  • **
  • Posts: 28
Re: The impossible is nothing or B3 and Cyrillic
« Reply #9 on: September 18, 2012, 08:30:53 PM »
does not work in 1.9.2
can correct?

 


Rate this page +1 at Google Search