encode to utf8 before sending through pipe