wrap the encoding properly without requiring the user to do it