improve the method of parseEncoding.