Apply encoding