From 73b42ed1bec345415a6f3c1acf213f0e5424d774 Mon Sep 17 00:00:00 2001 From: Ebrahim Date: Thu, 3 Dec 2020 00:37:07 +0330 Subject: [PATCH] fix the way unicode character are displayed in generated responses in documents --- resources/views/partials/example-requests/bash.blade.php | 2 +- resources/views/partials/example-requests/javascript.blade.php | 2 +- resources/views/partials/example-requests/php.blade.php | 2 +- resources/views/partials/example-requests/python.blade.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/views/partials/example-requests/bash.blade.php b/resources/views/partials/example-requests/bash.blade.php index 5237be86..d010973f 100644 --- a/resources/views/partials/example-requests/bash.blade.php +++ b/resources/views/partials/example-requests/bash.blade.php @@ -7,7 +7,7 @@ @endforeach @endif @if(count($route['cleanBodyParameters'])) - -d '{!! json_encode($route['cleanBodyParameters']) !!}' + -d '{!! json_encode($route['cleanBodyParameters'], JSON_UNESCAPED_UNICODE) !!}' @endif ``` diff --git a/resources/views/partials/example-requests/javascript.blade.php b/resources/views/partials/example-requests/javascript.blade.php index 11b59569..0696e060 100644 --- a/resources/views/partials/example-requests/javascript.blade.php +++ b/resources/views/partials/example-requests/javascript.blade.php @@ -24,7 +24,7 @@ @endif @if(count($route['cleanBodyParameters'])) -let body = {!! json_encode($route['cleanBodyParameters'], JSON_PRETTY_PRINT) !!} +let body = {!! json_encode($route['cleanBodyParameters'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) !!} @endif fetch(url, { diff --git a/resources/views/partials/example-requests/php.blade.php b/resources/views/partials/example-requests/php.blade.php index 0c162a2d..60d127d6 100644 --- a/resources/views/partials/example-requests/php.blade.php +++ b/resources/views/partials/example-requests/php.blade.php @@ -20,5 +20,5 @@ $response = $client->{{ strtolower($route['methods'][0]) }}('{{ rtrim($baseUrl, '/') . '/' . ltrim($route['boundUri'], '/') }}'); @endif $body = $response->getBody(); -print_r(json_decode((string) $body)); +print_r(json_decode((string) $body, JSON_UNESCAPED_UNICODE)); ``` diff --git a/resources/views/partials/example-requests/python.blade.php b/resources/views/partials/example-requests/python.blade.php index ac78f226..e1c349df 100644 --- a/resources/views/partials/example-requests/python.blade.php +++ b/resources/views/partials/example-requests/python.blade.php @@ -4,7 +4,7 @@ url = '{{ rtrim($baseUrl, '/') }}/{{ ltrim($route['boundUri'], '/') }}' @if(count($route['cleanBodyParameters'])) -payload = {!! json_encode($route['cleanBodyParameters'], JSON_PRETTY_PRINT) !!} +payload = {!! json_encode($route['cleanBodyParameters'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) !!} @endif @if(count($route['cleanQueryParameters'])) params = {!! \Mpociot\ApiDoc\Tools\Utils::printQueryParamsAsKeyValue($route['cleanQueryParameters'], "'", ":", 2, "{}") !!}