deal the encoding problem