strip whitespace, parse line endings