Fix line ending issues when parsing files
Add test for line ending handling