-
Bug
-
Resolution: Fixed
-
Critical
-
3.1
-
MOODLE_31_STABLE
-
MOODLE_31_STABLE
-
MDL-54868-master -
-
3.2 Sprint 2
After upgrading to Moodle 3.1, I noticed a problem with encoding for special chars when fetching data via web services in XMLRPC.
I test the same client script to fetch the same data from a Moodle 3.0 and a Moodle 3.1 installations:
- In Moodle 3.0, reply is as expected, and I get: a test course ÑÑÑ
- In Moodle 3.1, encoding is different, and I get: a test course ÑÑÑ
This happens the same when I use my own web services, and when I use the core Moodle ones.
I could not find any info about any required changes on web services after upgrading to Moodle 3.1, so I wanted to know if this is an error in Moodle, or if there is something I need to change in client code.
Tes script used is:
$token = 'a3a57916df3910e094e23e572e2a817b';
$domainname = 'http://localhost/j30/moodle';
$functionname = 'core_course_get_courses';
$params = array ();
/// XML-RPC CALL
header('Content-Type: text/plain');
$serverurl = $domainname . '/webservice/xmlrpc/server.php'. '?wstoken=' . $token;
require_once('./curl.php');
$curl = new curl;
$curl->setHeader('Content-type: text/xml');
$post = xmlrpc_encode_request($functionname, array($params));
$resp = xmlrpc_decode($curl->post($serverurl, $post));
echo ($resp[1]['fullname']);
Thanks,
Antonio