www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21815] New: std.format: invalid UTF-character throws with

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

          Issue ID: 21815
           Summary: std.format: invalid UTF-character throws with width
                    but not without
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: bugzilla bernis-buecher.de

char[1] c;
writefln!"%s"(c[]);
writefln!"%5s"(c[]);

The first writefln prints 0xff-character, while the second one throws an
UFTException: "Attempted to decode past the end of a string (at index 1)".

IMHO, the second one should not throw, but just write some (four?) spaces and a
0xff-character.

--
Apr 09 2021