cleaned up newline removal in encoder
Merge pull request #2 from sigv/fix-encoder-newline

The encoder has messy newline detection