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.
Comment #1 by bugzilla — 2021-05-04T09:23:57Z
Reading the unicode standard, I think, I erred here on what should happen. Actually, the invalid 0xff character should be replaced by a 0xFFFD-replacement character in both versions (or both versions should throw, but that is not recommended any more, because it might permit a denial of service attack).
Comment #2 by robert.schadek — 2024-12-01T16:38:41Z