[Issue 7054] std.format.formattedWrite uses code units count as width instead of characters count

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Feb 11 17:02:59 PST 2016


https://issues.dlang.org/show_bug.cgi?id=7054

--- Comment #7 from hsteoh at quickfur.ath.cx ---
Argh. Welcome to Unicode, where exceptions *are* the norm, and no simple
algorithm is simple in practice.

And this is a double-argh, because when it comes to double-width characters,
whether or not the output will even *look* right depends on what kind of
terminal you're using, and how it handles double-width characters. Older
terminals may not recognize double-width characters, and such characters may
end up formatted as if they were single-width. (But then again, such terminals
will already make a big unreadable mess of double-width characters anyway, so
perhaps it's not so important to cater to them.)

But once you start down this slippery slope, the next thing that will come up
is making `writefln` support right-to-left text, then vertical text, etc., and
before you know it, we'll be reinventing libpango except poorly (and for a text
terminal where it's questionable whether such things are even relevant
anymore).

--


More information about the Digitalmars-d-bugs mailing list