check if response.setEncoding function exist

this function doesn't exist on all clients