Fix encoder to support newlines separated by pipes