August 07, 2020
https://issues.dlang.org/show_bug.cgi?id=21131

          Issue ID: 21131
           Summary: Appender with string does not process UTF input ranges
                    properly
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody@puremagic.com
          Reporter: schveiguy@yahoo.com

When putting ranges of code units into an appender of a different width string, Appender uses integer promotion instead of decoding and reencoding to append to the string.

Example:

    auto str = "ウェブサイト";
    auto wstr = appender!wstring();
    put(wstr, str.byCodeUnit);
    writeln(wstr.data);

This outputs:

ã¦ã§ããµã¤ã

The fix is to detect this unique situation and decode the data into dchars.

--