MindscapeHQ/raygun4php

UTF-8 encoding not working on v1.8 for php 5.3+

Closed this issue · 3 comments

UTF-8 encoding not working on my end every time I send and error/ exception it removes all special characters

Hi @acanuto, can you please provide some steps to reproduce?

@robbieaverill thanks for the quick reply, here goes the code block I'm using

`require_once "vendor/raygun4php/src/Raygun4php/RaygunClient.php";

$client = new \Raygun4php\RaygunClient("API TOKEN REMOVED");
$name = "É";

try {
throw new Exception("Name: " . $name);
} catch (Exception $exception) {
$client->SendException($exception);
}`

on Raygun appears "Exception: Name: "

Using PHP 7.3 on a shared server hosting.
Wasn't able to run the newest version of raygun4php

Added setlocale(LC_CTYPE, 'pt_PT');

function toJsonRemoveUnicodeSequences($struct) { setlocale(LC_CTYPE, 'pt_PT'); return preg_replace_callback("/\\\\u([a-f0-9]{4})/", function($matches){ return iconv('UCS-4LE','UTF-8',pack('V', hexdec("U$matches[1]"))); }, json_encode($struct)); }

It's now working like it should, going to close the issue =)