Do not support Chinese.
Closed this issue · 4 comments
jiminggist commented
Fitnr,
Just noticed that this plugins do not support Chinese. Python is not my language and I have no idea how to have it fixed. So I cannot give you a pull:(
user,age,description
jiming,2323432,中文
tom,32,aaaa
Thanks!
Jiming
fitnr commented
This is corrected. Unfortunately, Chinese characters don't appear as perfectly fixed-width in text tables, at least in the typeface I use.
jiminggist commented
def is_chinese(uchar):
if uchar >= u'\u4e00' and uchar <= u'\u9fa5':
return True
return False
def chinese_word_len(u):
if is_chinese(u):
return 2
return 1
def get_sentence_len(uw):
i = 0
for u in uw:
i += chinese_word_len(u)
return i
a = u"更新,,a至1209期"
print get_sentence_len(a)
jiminggist commented
Is the previous code useful?
fitnr commented
I'd rather not add in code that depends on particular display settings, like the relative width of characters.