lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hash: SHA1

Juri Munkki wrote:
> Most MacOS text/source editors still
> support different types of line endings, CR-only included.

It's still one of the standard options in vim: the fileformat variable can be
set to dos (crlf), unix (lf), or mac (cr).

In general when writing software to read text files, what you want to do is
treat any cr or lf as a line break, *but* if you receive a cr followed
immediately by a lf, the pair of characters is considered to be a single line
break. This gets it right in just about all cases.

SMTP, of course, is one of the cases where this doesn't work, for reasons
discussed earlier --- you need to be able to distinguish between different
types of line break.

What would be really nice is a way of programmatically telling the socket
library how to split lines, via, say, a regexp. Unfortunately that would
probably have a really major performance hit...

- --
┌── ─── ───────────────────
│ "There does not now, nor will there ever, exist a programming language in
│ which it is the least bit hard to write bad programs." --- Flon's Axiom
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla -