protected function encode_request($functionname, $params) {

        $outputoptions = array(
            'encoding' => 'utf-8',
            'escaping' => 'markup',
        );

        // See MDL-53962 - needed for backwards compatibility on <= 3.0.
        $params = array_values($params);

        return xmlrpc_encode_request($functionname, $params, $outputoptions);
    }