CRM-12738 - Handle ampersands in API parameters

Found this in a locally modified copy of class.api.php - worth reviewing this in case we need to handle other url characters.