[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
Fri Feb 12 05:23:38 PST 2016


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

--- Comment #8 from Stewart Gordon <smjg at iname.com> ---
(In reply to Marco Leise from comment #6)
> https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms

So "halfwidth" means the width of a character cell, and "fullwidth" means
double that width.  Seems counter-intuitive.  I would have expected them to be
something like "singlewidth" and "doublewidth" respectively.

So there a few different units at work here:
- code units
- codepoints
- graphemes
- width units

A further complication is whether formattedWrite should be geared towards text
terminals, writing data to a text file designed for human reading, writing data
to a text file that follows a rigid format for machine processing or what.  So
it looks like there's no simple solution.  But in 99% of cases, using code
units (as it does at the moment) is bound to be wrong.

--


More information about the Digitalmars-d-bugs mailing list