lua-users home
lua-l archive

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


-----BEGIN PGP SIGNED MESSAGE-----
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...

- --
┌── dg@cowlark.com ─── http://www.cowlark.com ───────────────────
│
│ "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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGpJc+f9E0noFvlzgRAkzGAJ9sm5BokEOhvdektOk+FI+NxVe0awCeKVCK
dl7LjcxoFu/8gUM/Aj1Zq3I=
=ZC7w
-----END PGP SIGNATURE-----