encode right before sending over