solve encode problem