Closed Waxter81 closed 4 years ago
I've made a change to allow you to get the commands in a response. Check the 3.1.8 release.
You can therefore apply any change you need on the command before they are sent back to the browser.
jaxon()->callback()->after(function($target, $bEndRequest) {
$response = jaxon()->di()->getResponseManager()->getResponse();
$commands = $response->getCommands();
// Apply any change you want on the commands
foreach($commands as $command)
{
....
}
// Reset the changed commands in the response
$response->clearCommands()->appendResponse($commands);
});
I hope this will help in solving your issue.
Thank you!!
But I think you have to change clearCommands() Method
$this->aCommands[] = [];
to
$this->aCommands = [];
Changing this, I solved my issue and all responses are previously converted to UTF-8.
PD: Do you have any link for donations?
I know this "issue" was discussed and closed in #18 , but I would like to reopen it to ask you (🙏) considering again the encoding of the Response to UTF-8 when the encoding is ISO-8859-1.
I have a lot of code migrated from XAJAX where it was not necessary to encode manually this response, and only a few lines extra in getOutput() in Response Class would be very helpful for me.
The behaviour If we forget to encode the Response is annoying because Jaxon request fails silently with no error message, even with debug enabled.
Something like this:
With some utf converter function like this:
Thank you!