Decode payload and remove heading or trailing empty lines.