Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: russian commands doesn't work properly #799

Closed
op-hui opened this issue Sep 4, 2015 · 8 comments
Closed

Bug: russian commands doesn't work properly #799

op-hui opened this issue Sep 4, 2015 · 8 comments

Comments

@op-hui
Copy link

op-hui commented Sep 4, 2015

Steps to reproduce the issue:

  1. Create command with russian utf-8 characters
  2. Try use command in game. For example command name is "команда", applying for player "player"
  3. U - user input, S - server side
U: команда player 
S: Could not find 'ayer'.
U: команда  player #  TWO spaces between command and playername
S: Could not find 'layer'. 
U: команда   player # THREE spaces between command and playername
S: ok

If put THREE spaces between utf-8 russian command name and plaername, they will fork fine

What I expect to see and what I actually see (tracebacks, error messages etc):

I see: команда player -> Could not find 'ayer'
I expected: команда player -> ok
No error messages in log

Extra information, such as Evennia revision/repo/branch, operating system and ideas for how to solve:

$ evennia --version

    Evennia 0.5.0 (rev a1eadef) (rev a1eadef)
    OS: posix
    Python: 2.7.6
    Twisted: 15.4.0
    Django: 1.8.4

@Griatch
Copy link
Member

Griatch commented Sep 4, 2015

@op-hui: Could you also post the source code for your "команда" command?

@op-hui
Copy link
Author

op-hui commented Sep 4, 2015

class CmdTest(Command):

        key = "команда"
        aliases = ["команда2"] 
        locks = "cmd:all()"
        help_category = "General"

        def parse(self):
            "Very trivial parser" 
            self.target = self.args.strip() 

        def func(self):
            "This actually does things"
            caller = self.caller
            if not self.target or self.target == "here":
                string = "%s команда." % caller.name
                caller.location.msg_contents(string, exclude=caller)
                caller.msg("Ты команда")
            else:
                target = caller.search(self.target)
                if not target: 
                    # caller.search handles error messages
                    return
                string = "%s команда на тебя." % caller.name
                target.msg(string)
                string = "Ты команда на %s." % target.name
                caller.msg(string)
                string = "%s команда %s." % (caller.name, target.name)           
                caller.location.msg_contents(string, exclude=[caller,target])

@Griatch
Copy link
Member

Griatch commented Sep 4, 2015

@op-hui I can't test this right now, but what do you get if you do print self.target, self.args (prints will appear in your log/terminal) before going into caller.search?

@op-hui
Copy link
Author

op-hui commented Sep 4, 2015

Got it, put debug before caller.search
i'm trying apply команда to anonymous player
and got in logs 2015-09-04 10:29:46+0000 [-] onymous onymous

@op-hui
Copy link
Author

op-hui commented Sep 4, 2015

Bug presented in webclient and telnet sessions

@op-hui
Copy link
Author

op-hui commented Sep 4, 2015

Between command named 'команда' and player name (named anonymous) i can put ANY THREE CHARACTERS:

>командаXXXplayer
Ok
>командаYYYplayer
Ok
>командаYYplayer
Could not find 'layer'.

@Griatch
Copy link
Member

Griatch commented Sep 4, 2015

Thanks for the further info. My first guess is that this may be a regex error in Evennia's command parser, possibly it is not setting the UNICODE flag correctly somewhere. Will look at it tonight.

@Griatch
Copy link
Member

Griatch commented Sep 4, 2015

This is resolved in a7e42b2. Closing.

@Griatch Griatch closed this as completed Sep 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants