encodes input before rendering