[Issue 7054] writef formats strings containing UTF-8 multibyte characters to the wrong width

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 4 18:08:07 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=7054


Stewart Gordon <smjg at iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |spec
                 CC|                            |smjg at iname.com
            Summary|formatting fixed width      |writef formats strings
                   |string fields w/utf         |containing UTF-8 multibyte
                   |                            |characters to the wrong
                   |                            |width
           Severity|enhancement                 |normal


--- Comment #1 from Stewart Gordon <smjg at iname.com> 2011-12-04 18:08:04 PST ---
(In reply to comment #0)
> Using a width specifier in conjunction with a utf string fails.  It would be
> nice to have a %S modifier that handles this situation.

We shouldn't need a different format specifier for this.  It's a matter of what
"Width" means in the format string spec, not one of different kinds of string
format.

http://www.d-programming-language.org/phobos/std_format.html
"Specifies the minimum field width. If the width is a *, the next argument,
which must be of type int, is taken as the width. If the width is negative, it
is as if the - was given as a Flags character."

While it doesn't specify the units the width is measured in, it seems a
reasonable assumption that it is intended to be characters, rather than bytes.

Indeed, 1.071's version gets it right, so clearly the bug is in the D2 line's
implementation.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list