[Issue 15293] File().byLine().map!toUpper throws UnicodeException at src\rt\util\utf.d(290): invalid UTF-8 sequence on pure ASCII file

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Nov 6 04:22:37 PST 2015


https://issues.dlang.org/show_bug.cgi?id=15293

--- Comment #3 from HeiHon <heiko.honrath at web.de> ---
Thanks for this reduction!
It also crashes with:

static import std.file;
import std.stdio: File, writeln;
import std.string: toUpper, toLower;

void main()
{
    std.file.write("gen.txt", "12345678\n1234567\n12345678a");
    foreach(ln; File("gen.txt").byLine())
    {
        writeln(ln);
        writeln("> ", toLower(ln));
    }
    foreach(ln; File("gen.txt").byLine())
    {
        writeln(ln);
        writeln("> ", toUpper(ln));
    }
}

If the last character is lowercase then toUpper crashes.
If it is uppercase then toLower crashes.

--


More information about the Digitalmars-d-bugs mailing list