[issue24665] CJK support for textwrap

INADA Naoki report at bugs.python.org
Sun Jul 8 14:25:55 EDT 2018


INADA Naoki <songofacandy at gmail.com> added the comment:

I'm not expert of this area, but Korean support is still totally broken:

>>> import unicodedata
>>> s = "\u1100\u1161\u11a8"
>>> unicodedata.east_asian_width(s[0])
'W'
>>> unicodedata.east_asian_width(s[1])
'N'
>>> unicodedata.east_asian_width(s[2])
'N'
>>> s
'각'
>>> s[:2]
'가'
>>> print(s[:2] + '\n' + s[2:])
가
ᆨ
>>> print(s[:1] + '\n' + s[1:])
ᄀ
ᅡᆨ


I think "CJK support" is not nice naming for just using east_asian_width.
PR-5649 doesn't use "CJK" word in APIs, but uses in commit log (PR title)
and NEWS entry.

Maybe, it should be "Textwrap now uses ``unicodedata.east_asian_width()``
to calculate text width when unicodedata is available."

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue24665>
_______________________________________


More information about the Python-bugs-list mailing list