changes encoding function