[Issue 21131] New: Appender with string does not process UTF input ranges properly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 7 00:37:56 UTC 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 at puremagic.com
          Reporter: schveiguy at 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.

--


More information about the Digitalmars-d-bugs mailing list