The width of East Asian character takes on either of two values: narrow or wide.
For wide characters, they takes double widths than narrow. (Reference: http://unicode.org/reports/tr11/)
So, we can't calculate the column width by Python function len, which just returns
the number of characters.
For example, the width of 中文 should be 4, but len('中文') returns 2.
I think a better approach would be to use _get_width() for everything (completely replacing len throughout terminaltables.py) and have that return the "terminal length" of every string and unicode character.
The width of East Asian character takes on either of two values: narrow or wide. For wide characters, they takes double widths than narrow. (Reference: http://unicode.org/reports/tr11/)
So, we can't calculate the column width by Python function
len
, which just returns the number of characters.For example, the width of 中文 should be 4, but
len('中文')
returns 2.