title: Laravel "Malformed UTF-8 characters, possibly incorrectly encoded", how to fix?
body: <p>I try to return as json added attribute which I get with the following method in my User model but I keep getting </p>
  
  <pre><code> "message": "Malformed UTF-8 characters, possibly incorrectly encoded",
      "exception": "InvalidArgumentException",
      "file": "/var/www/timetool/vendor/laravel/framework/src/Illuminate/Http/JsonResponse.php",
  </code></pre>
  
  <p>the code </p>
  
  <pre><code>   /**
       * @return string
       */
      public function getAvatarImageAttribute($value)
      {
  
          if($this-&gt;hasMedia('avatar')) {
               $image = $this-&gt;getMedia('avatar');
               $img = \Intervention\Image\ImageManagerStatic::make($image[0]-&gt;getPath())-&gt;encode('data-url');
           }
           elseif (isset($this-&gt;blob-&gt;dokument)) {
               $img = 'data:image/jpeg;base64,'. base64_encode($this-&gt;blob-&gt;document);
           } else {
               $img = '';
           }
  
           return $img;
      }
  </code></pre>
  
  <p>in controller I have </p>
  
  <pre><code>return \Response::json($users, 200, array('Content-Type' =&gt; 'application/json;charset=utf8'), JSON_UNESCAPED_UNICODE);
  </code></pre>