Text reflow woes (or: I want bullets back!)y
Michael Lazar
lazar.michael22 at gmail.com
Sat Jan 18 05:02:42 GMT 2020
On Thu, Jan 16, 2020 at 5:12 PM solderpunk <solderpunk at sdf.org> wrote:
>
> On Thu, Jan 16, 2020 at 01:09:18PM -0800, Aaron Janse wrote:
> > Oops, I meant to mention two things:
> > 1. Clients are already using TLS. I think wrapping is significantly
> > easier than encryption.
>
> I was about to quip that the TLS is made really easy by high-level
> library support while the wrapping has to be done manually, but then I
> thought to check and, holy heck, Python has a `textwrap` module I wasn't
> aware of.
Python's textwrap module is fundamentally flawed for unicode and they have no
intention of ever fixing it [0]. Once you start going down the rabbit hole of
CJK characters, emojis, grapheme clusters, etc. it becomes exceedingly hard
to figure out how to correctly determine the width of unicode text. You can
get it working 99% of the time, but there's always those fringe cases that
no one thinks about until somebody files a bug report.
I don't know if this has any bearing on the discussion, but it's worth keeping
in the back of your mind if you intend to make unicode a first-class citizen.
I would be cautious about calling text wrapping "significantly" easier than TLS
or anything else for that matter. This was actually one of the things that drew
me to gopher in the first place, I could assume everything was ASCII and throw
all of that complexity out the window.
[0] https://bugs.python.org/issue24665
More information about the Gemini
mailing list