python - Counting characters that print, not processed, in a string -


dealing annoying issue using foreign characters (ģ,č,ŗ,ļ,ā,ē,ū,ī,ņ,š,ķ,ž , capitals). have length using len not equal 1, example len('ī') 2 (it shows \xc4\xab when processing text). function gives 1 characters. help?

kudos robᵩ explanatory webpage. concise solution problem:

def varlen(string):     return len(string.decode('utf-8')) 

Comments