www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10191] New: std.array.array and Unicode strings


           Summary: std.array.array and Unicode strings
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc

--- Comment #0 from bearophile_hugs eml.cc 2013-05-28 03:27:40 PDT ---
import std.stdio: writeln;
import std.algorithm: map;
import std.array: array;
void main() {
    string a = "\u03A9\u03A9ab";
    a.map!(a => "<"d ~ a ~ ">"d).writeln;
    a.map!(a => "<"d ~ a ~ ">"d).array.writeln;

Prints (dmd 2.063beta7):

["<Omega>", "<Omega>", "<a>", "<b>"]
["<Omega>", "<Omega>", "<a>", "<b>", "", ""]

Expected output:

["<Omega>", "<Omega>", "<a>", "<b>"]
["<Omega>", "<Omega>", "<a>", "<b>"]

Found by Timothee Cour:
http://forum.dlang.org/post/mailman.301.1369735563.13711.digitalmars-d-learn puremagic.com

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 28 2013