fixed bug where line feed and carriage return were not encoded