change $params->get('encode', 1) to $params->get('encode')