X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/ce566bea2a2f5e120cc09808f9d3a4aee79589c2..refs/pull/3918/head:/app/Exceptions/JsonDebugException.php diff --git a/app/Exceptions/JsonDebugException.php b/app/Exceptions/JsonDebugException.php index e8d61305e..8acc19778 100644 --- a/app/Exceptions/JsonDebugException.php +++ b/app/Exceptions/JsonDebugException.php @@ -19,10 +19,13 @@ class JsonDebugException extends Exception } /** - * Covert this exception into a response. + * Convert this exception into a response. + * We add a manual data conversion to UTF8 to ensure any binary data is presentable as a JSON string. */ public function render(): JsonResponse { - return response()->json($this->data); + $cleaned = mb_convert_encoding($this->data, 'UTF-8'); + + return response()->json($cleaned); } }