It looks like in python (2.x) you are counting the byte length, not the number of characters.
Convert the byte string to a unicode object with str.decode, then count the characters:
len(byte_string_object.decode('utf-8'))
You may also need to remove spatial spaces:
len(byte_string_object.decode('utf-8').strip())
>>> len('استنفار')
14
>>> len(u'استنفار')
7
>>> len('استنفار'.decode('utf-8'))
7
source
share