Skip to content

Commit

Permalink
Changed cmdparser to properly convert to unicode before length measur…
Browse files Browse the repository at this point in the history
…ing, which was causing unexpected behavior with non-ASCII charsets.
  • Loading branch information
Griatch committed Sep 4, 2015
1 parent 3fcee45 commit a7e42b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion evennia/commands/cmdparser.py
Expand Up @@ -60,7 +60,7 @@ def create_match(cmdname, string, cmdobj):
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)
Expand Down
2 changes: 1 addition & 1 deletion evennia/commands/command.py
Expand Up @@ -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'):
Expand Down

0 comments on commit a7e42b2

Please sign in to comment.