[issue12568] Add functions to get the width in columns of a character

Martin v. Löwis report at bugs.python.org
Tue Oct 18 09:49:16 CEST 2011


Martin v. Löwis <martin at v.loewis.de> added the comment:

>> I'm -1 on using wcswidth, though.
> 
> When you write text into a console on Linux (e.g. displayed by
> gnome-terminal or konsole), I suppose that wcswidth() can be used to
> compute the width of a line. It would help to fix #2382.
> 
> Or do you think that wcswidth() gives the wrong result for this use
> case?

No, I think that using it is not necessary. If you want to compute the
width of a line, use unicodedata.east_asian_width. And yes, wcswidth
may sometimes produce "incorrect" results (although it's probably
correct most of the time).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12568>
_______________________________________


More information about the Python-bugs-list mailing list