www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21131] New: Appender with string does not process UTF input


          Issue ID: 21131
           Summary: Appender with string does not process UTF input ranges
           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.


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

This outputs:


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

Aug 06 2020