line ending normalization with byte order mark awareness