You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
private function decodeResponse(Response $response)
{
if ($response->getStatusCode() === 204 || $response->getBody()->getSize() === 0) {
return null;
}
$response->getBody()->rewind();
try {
$bodyContent = $response->getBody()->getContents();
if (!mb_check_encoding($bodyContent, 'UTF-8')) {
$bodyContent = mb_convert_encoding($bodyContent, 'UTF-8', 'ISO-8859-1'); // Exemple de conversion
if (!mb_check_encoding($bodyContent, 'UTF-8')) {
throw new \Exception('Failed to convert response body to valid UTF-8');
}
}
return json_decode($bodyContent, true, 512, JSON_THROW_ON_ERROR);
} catch (\Exception $e) {
var_dump($response->getBody()->getSize());
var_dump($response->getStatusCode());
// Réinitialiser le curseur du flux avant de le lire à nouveau pour le débogage
$response->getBody()->rewind();
var_dump($response->getBody()->getContents());
die($e->getMessage());
}
}`
Thanks
Guldil
The text was updated successfully, but these errors were encountered:
We got an internal issue that led to some failures regarding some UTF8 data.
This should now be fixed, could you please give it a retry and give us some feedback please?
Hello,
First time after 18 months i got this error.
I'm exporting billing details with $detail = $conn->get('/me/bill/' . $id . '/details/' . $detailid);
Today on my VOIP invoice i got error : "Malformed UTF-8 characters, possibly incorrectly encoded"
After some debug with ChatGPT it's come from this kind of detail :
string(278) "{"periodEnd":"2024-08-01","totalPrice":{"currencyCode":"EUR","value":0,"text":"0.00 €"},"quantity":"1","periodStart":"2024-07-01","domain":"XXXXXXXXXXXXX","billDetailId":"XXXXXXXXXXXX","unitPrice":{"text":"0 €","currencyCode":"EUR","value":0},"description":"Un num▒ro port▒"}"
chatGPT rewrote the function :
The text was updated successfully, but these errors were encountered: