Changed cmdparser to properly convert to unicode before length measuring, which was causing unexpected behavior with non-ASCII charsets.

This commit is contained in:
Griatch 2015-09-04 21:11:01 +02:00
parent 3fcee453b9
commit a7e42b2a5b
2 changed files with 2 additions and 2 deletions

View file

@ -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)