Safe removing whitespace and line endings