digitalmars.D.bugs - [Issue 5378] New: File.byLine terminator string
- d-bugmail puremagic.com (42/42) Dec 26 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5378
- d-bugmail puremagic.com (10/10) Jan 09 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5378
- d-bugmail puremagic.com (12/12) Jan 08 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5378
- d-bugmail puremagic.com (11/11) Jan 08 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5378
- d-bugmail puremagic.com (14/14) Mar 16 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5378
- d-bugmail puremagic.com (7/9) Mar 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5378
- d-bugmail puremagic.com (6/6) Mar 18 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5378
- d-bugmail puremagic.com (11/11) Aug 08 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5378
- d-bugmail puremagic.com (16/16) Aug 11 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5378
- d-bugmail puremagic.com (9/9) Aug 12 2013 http://d.puremagic.com/issues/show_bug.cgi?id=5378
http://d.puremagic.com/issues/show_bug.cgi?id=5378 Summary: File.byLine terminator string Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc This is the signature of File.byLine: ByLine!(Char,Terminator) byLine(Terminator = char, Char = char) (KeepTerminator keepTerminator = KeepTerminator.no, Terminator terminator = '\x0a'); But on Windows the line terminators are 2 chars long (CR+LF), see: http://en.wikipedia.org/wiki/Newline#Representations So I think the second argument of argument byLine() needs to be a string. This is code I expected to use, that currently is not accepted: import std.stdio; void main() { auto lines = File("test.txt").byLine(File.KeepTerminator.no, "\r\n"); } ---------------- After that bug report, a little enhancement request: generally on Windows I usually open files with Windows-style line terminators, while on Linux I open files with Unix-style line terminators, so if possible a better default for the second argument of byLine() is a string constant that changes according to the operating system. ---------------- A workaround is to open the file in text mode, but I don't know if this works well if you want to open a Windows-style file on Linux: import std.stdio; void main() { auto lines = File("test.txt", "r").byLine(); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 26 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5378 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei metalanguage.com AssignedTo|nobody puremagic.com |andrei metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 09 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5378 Andrei Alexandrescu <andrei erdani.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |INVALID PST --- This is by design. The length name is special and defined to return size_t compulsively. You may want to choose a different name instead. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 08 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5378 Andrei Alexandrescu <andrei erdani.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID | PST --- Oops, wrong window. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 08 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5378 Vladimir Panteleev <thecybershadow gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |thecybershadow gmail.com 10:40:03 EET --- Would it be acceptable if we special-cased byLine to strip a trailing \r if the terminator is \n? Often, the programmer doesn't know beforehand if the line terminator of a text file will be \r\n or \n. A behavior close to that of splitLines would be more useful than forcing the programmer to choose an exact terminator sequence. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 16 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5378Would it be acceptable if we special-cased byLine to strip a trailing \r if the terminator is \n?Probably the problem presented in this issue has various solutions. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5378 12:11:08 PDT --- *** Issue 9750 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 18 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5378 Nick Treleaven <ntrel-public yahoo.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull CC| |ntrel-public yahoo.co.uk 07:18:09 PDT --- https://github.com/D-Programming-Language/phobos/pull/1458 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 08 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5378 Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/7f76586e16623894c7b6119014f76ed7bfef527e Fix Issue 5378 - Make File.byLine accept a string terminator Add an overload of byLine without a default argument for terminator. Before, byLine!string tried to instantiate "string terminator = '\n'", which is invalid. Note: This removes the default arguments from ByLine.this, but the constructor was never documented anyway (unlike the range primitives). https://github.com/D-Programming-Language/phobos/commit/5576d899af510de798b0d5aaa8bd13e6caebfbce Fix Issue 5378 - Make File.byLine accept a string terminator -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 11 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5378 Nick Treleaven <ntrel-public yahoo.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 12 2013