add encoding judgement