fix the encoding bugs

Signed-off-by: knightuniverse <knightuniverse@qq.com>