add conditional encoding conversion