digitalmars.D.bugs - [Issue 15293] New: File().byLine().map!toUpper throws
- via Digitalmars-d-bugs (42/42) Nov 05 2015 https://issues.dlang.org/show_bug.cgi?id=15293
https://issues.dlang.org/show_bug.cgi?id=15293 Issue ID: 15293 Summary: File().byLine().map!toUpper throws UnicodeException src\rt\util\utf.d(290): invalid UTF-8 sequence on pure ASCII file Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: normal Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: heiko.honrath web.de Created attachment 1561 --> https://issues.dlang.org/attachment.cgi?id=1561&action=edit ASCII-textfile which throws UTF8 exception File().byLine().map!toUpper throws UnicodeException src\rt\util\utf.d(290): invalid UTF-8 sequence on pure ASCII file .map!toLower throws at a different location with the same file If neither toLower nor toUpper are used, the file is read completely. program generator.d: module generator; // 2015-11-05 // dmd2.069 // built with: rdmd --build-only --force -version=WindowsXP -version=Unicode -release -O generator.d // to reproduce run: generator gentest.txt import std.stdio, std.algorithm, std.string, std.format; void main(string[] args) { int line_number = 1; auto gen = File(args.length > 1 ? args[1] : "gentest.txt") .byLine() .map!chomp .map!toUpper //~ .map!toLower .map!(line => format("Line %4s: %s", line_number++, line)); writefln("%-(%s\n%)", gen); } --
Nov 05 2015