title: Laravel get request body with correct encoding
body: <p>The function is simple, I need to forward a post request to an external API service. I am using Laravel 5.5 and the $client is Guzzle 6 client;</p>
  
  <pre><code>use Illuminate\Http\Request;
  use GuzzleHttp\Client; 
  
  public function insert(Request $request)
  {
      try {
          $body =  $request-&gt;json()-&gt;all();
          $response = $this-&gt;client-&gt;post($this-&gt;generateUrl("/api/sections?", $request-&gt;getQueryString()), ['json' =&gt;$body]);
          return response($response-&gt;getBody(),$response-&gt;getStatusCode())&gt;withHeaders($response-&gt;getHeaders());
      }catch(Exception $e){
        .....
      }
  }
  </code></pre>
  
  <p>the problem is the $bodyStringRAW =  $request->json()->all();</p>
  
  <p>the data send to laravel is
   <strong>[{"name":"Secion4小明","comment":"","applicationId":"59"}]</strong></p>
  
  <p>the data received by the external API is <strong>[{"name":"Secion4\u5c0f\u660e","comment":null,"applicationId":"59"}]</strong></p>
  
  <p>If i change the code to </p>
  
  <pre><code>$response = $this-&gt;client-&gt;post($this-&gt;generateUrl("/api/sections?", $request-&gt;getQueryString()), ['json' =&gt;$request-&gt;getContent()]);
  </code></pre>
  
  <p>the external API received the data as 
  <strong>[{\"name\":\"Secion4\u5c0f\u660e\",\"comment\":\"\",\"applicationId\":\"59\"}]</strong></p>
  
  <p>How can I make the encoding correct? I Can't find the way to set the encoding.</p>
  
  <p><strong>Update 1:</strong></p>
  
  <pre><code> $body =  utf8_decode($request-&gt;getContent());
   $response = $this-&gt;client-&gt;post($this-&gt;generateUrl("/api/sections?", $request-&gt;getQueryString()), ['json' =&gt;$body]);
  </code></pre>
  
  <p>External API got 
  [{\"name\":\"Secion4??\",\"comment\":\"\",\"applicationId\":\"59\"}]</p>