Support cross-platform newlines.
Add tests for issue #45.