title: CakePhp 3.x, TCPDF, htmlspecialchars
body: <p>I´ve installed the plugin "CakePDF" following the documentation: <a href="https://github.com/FriendsOfCake/CakePdf" rel="noreferrer">https://github.com/FriendsOfCake/CakePdf</a></p>
  
  <p>Now I want to build the first PDF and I´ve got the following error:</p>
  
  <p><a href="https://i.stack.imgur.com/P7ACq.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/P7ACq.jpg" alt="enter image description here"></a></p>
  
  <p>This is my configuration in the bootstrap.php:</p>
  
  <pre><code>Configure::write('CakePdf', [
      'engine' =&gt; 'CakePdf.Tcpdf',
      'margin' =&gt; [
          'bottom' =&gt; 15,
          'left' =&gt; 50,
          'right' =&gt; 30,
          'top' =&gt; 45
      ],
      'download' =&gt; true,
      'encoding' =&gt; 'UTF-8'
  ]);
  </code></pre>
  
  <p>The only code I´ve written is the following one in the template:</p>
  
  <pre><code>$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
  </code></pre>
  
  <p>This is the code from line 68 in functions.php:</p>
  
  <pre><code>function h($text, $double = true, $charset = null)
      {
          if (is_string($text)) {
              //optimize for strings
          } elseif (is_array($text)) {
              $texts = [];
              foreach ($text as $k =&gt; $t) {
                  $texts[$k] = h($t, $double, $charset);
              }
              return $texts;
          } elseif (is_object($text)) {
              if (method_exists($text, '__toString')) {
                  $text = (string)$text;
              } else {
                  $text = '(object)' . get_class($text);
              }
          } elseif (is_bool($text)) {
              return $text;
          }
  
          static $defaultCharset = false;
          if ($defaultCharset === false) {
              $defaultCharset = mb_internal_encoding();
              if ($defaultCharset === null) {
                  $defaultCharset = 'UTF-8';
              }
          }
          if (is_string($double)) {
              $charset = $double;
          }
          return htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE, ($charset) ? $charset : $defaultCharset, $double);
      }
  </code></pre>
  
  <p>I´m absolutely confused and can´t find any solution. Has anyone an idea?</p>