From a7e42b2a5bece08fa5a1ae179b3835a19cc53c7e Mon Sep 17 00:00:00 2001 From: Griatch Date: Fri, 4 Sep 2015 21:11:01 +0200 Subject: [PATCH] Changed cmdparser to properly convert to unicode before length measuring, which was causing unexpected behavior with non-ASCII charsets. --- evennia/commands/cmdparser.py | 2 +- evennia/commands/command.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/evennia/commands/cmdparser.py b/evennia/commands/cmdparser.py index a280440baa..168f706259 100644 --- a/evennia/commands/cmdparser.py +++ b/evennia/commands/cmdparser.py @@ -60,7 +60,7 @@ def cmdparser(raw_string, cmdset, caller, match_index=None): full input string the cmdname takes up - an exact match would be 1.0. """ - cmdlen, strlen = len(cmdname), len(string) + cmdlen, strlen = len(unicode(cmdname)), len(unicode(string)) mratio = 1 - (strlen - cmdlen) / (1.0 * strlen) args = string[cmdlen:] return (cmdname, args, cmdobj, cmdlen, mratio) diff --git a/evennia/commands/command.py b/evennia/commands/command.py index 42e749e753..20344699ae 100644 --- a/evennia/commands/command.py +++ b/evennia/commands/command.py @@ -61,7 +61,7 @@ def _init_command(mcs, **kwargs): mcs.lock_storage = ";".join(temp) if hasattr(mcs, 'arg_regex') and isinstance(mcs.arg_regex, basestring): - mcs.arg_regex = re.compile(r"%s" % mcs.arg_regex, re.I) + mcs.arg_regex = re.compile(r"%s" % mcs.arg_regex, re.I + re.UNICODE) if not hasattr(mcs, "auto_help"): mcs.auto_help = True if not hasattr(mcs, 'is_exit'):