David A. Wheeler scripsit: > Background: Nobody officially uses LF CR as a line ending, but sometimes > people screw up and generate reversed LF CR line-endings. An EOL > detector can, after reading an LF, peek to see if the next char is a CR > (and if so consume that too), and thus be generous in what it accepts.
There's no reason to support LF CR. I'd think the most likely way for it to get generated is that someone writes a LF as end of line, and then someone else erroneously appends a blank line terminated by CR+LF to that, producing LF CR LF. So treat LF CR (with or without a following LF) as two separate lines. > I plan to also support IBM NEL. After pushing the NEL, CR NEL, and LS line terminators into XML 1.1, I've concluded that it was simply a mistake. For one thing, it makes you dependent on the details of the encoding beyond just ASCII-compatibility. Otherwise, you can do line-breaking at the byte level, as long as you avoid EBCDIC and UTF-16 (which XML implementations cannot do). That works well in Lisp implementations which still have the byte=character assumption baked in. In practice, mainframe text files don't seem to escape the mainframe without newline conversion as well as encoding conversion, so you don't run across such files in the wild. As for LS, I think a single sample file in UTF-16 issued years ago by the Unicode Consortium itself is the only example I've ever seen: it was obsolete as soon as it was created. ("N possible line terminators? Let's define our own. Oops, now we have N+1 line terminators.") -- John Cowan co...@ccil.org http://ccil.org/~cowan It's the old, old story. Droid meets droid. Droid becomes chameleon. Droid loses chameleon, chameleon becomes blob, droid gets blob back again. It's a classic tale. --Kryten, Red Dwarf ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d _______________________________________________ Readable-discuss mailing list Readable-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/readable-discuss