Closed yeruizhi closed 9 months ago
Duplicate of #49 and a number of other previously filed issues. I have previously provided an explanation of this at https://github.com/jazzband/prettytable/issues/213#issuecomment-1627747588. In short, this isn't caused by the library but rather by the font(s) that you're using, and there isn't anything that the library can do. You can try to use a monospace font that includes the Chinese character set, such as Sarasa Gothic.
I tried another testcase.
In this case above, the row2 had not been wrapped because the code assume row2 (len=50) was shorter than max_width, while row1(len=100) should be wrapped.
Prettytable wrap the string by character number counting, but ignore the fact that "full-width" takes two width while 'half-witdh" tasks one.
I think, it is about wrapping functionality, not about displaying.
Problem:
I want to put a long sentence in a cell, and it should be wrapped with given
max_table_width
.It works well when all characters are half-width characters.
But when some chinese characters (full-width characters) appeared in the row, the
max_table_width
cannot warp the line correctly. The sentence was wraped into several lines, but the line-width was not correct.Suggestion:
Support for full-width characters will be nice.