[issue24665] CJK support for textwrap
INADA Naoki
report at bugs.python.org
Mon Jul 9 04:58:24 EDT 2018
INADA Naoki <songofacandy at gmail.com> added the comment:
Thanks, Terry.
I have doubt about "east asian width" support should be merged.
While I agree it is "better than nothing", it may make textwrap much slower.
But I didn't have courage to reject the PR.
Textwrap focused on ASCII and English-like (space separated) language.
"support unicode" is very hard problem. We should consider about grapheme cluster (UAX29), east asian width (UAX11) (But utf8proc is better than UAX11), and line breaking algorithm (UAX14).
For wrapping text on terminal, some terminal emulators and multiplexers (e.g. tmux) implements much nicer algorithm.
I think 3rd party C extension based on algorithm used by tmux is best solution.
If someone really want this feature, please try it on PyPI.
I understand "want it in stdlib!". But text wrapping is very hard, complicated problem. Since stdlib grows slower, and backward compatibility restrict us, I think it should be implemented in 3rd party library first.
----------
dependencies: -textwrap.wrap: add control for fonts with different character widths
resolution: -> rejected
stage: patch review -> resolved
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue24665>
_______________________________________
More information about the Python-bugs-list
mailing list