change encoding function