some API's in tests don't return a response cause they fail to json_encode because of
Malformed UTF-8 characters, possibly incorrectly encoded. Tested this fix and it worked for me. Would maybe also need to create a general JSON class for this that always takes care of this in case we have same problem somewhere else? Not sure how good a fix it is as the input might not be utf8?
In test case there was eg
/page/index.htm?q=non unicode keyword ��������";s:7:"segment";s:103:"pageUrl==http%3A%2F%2Fexample.org%2Fpage%2Findex.htm%3Fq%3Dnon+unicode+keyword+%EC%E5%F8%EA%EE%E2%FB%E5";}i and it was converted to
fyi we use slightly different version in https://github.com/matomo-org/matomo/blame/3.x-dev/core/DataTable/Renderer/Csv.php#L477
not sure if any is better... the one in data table renderer should be fine though I suppose
Tests are passing, feel free to merge (not sure if you want to change to use the DataTable\Renderer code).