title: Encoding problem with caption in Imagemagick on php
body: <p>I'm adding some heading in Russian on the image using newPseudoImage and CAPTION.
  Heading can have some entities like <code>&amp;nbsp;</code> <code>&amp;mdash;</code> etc, so I clean it with html_entity_decode.
  In some cases it works well, but in some cases text after decoded entity goes in wrong encoding, like that:</p>
  <p><a href="https://i.stack.imgur.com/7dTD5.jpg" rel="nofollow noreferrer">look at second line - there is the problem</a></p>
  <p>Please, help me to find the solution.</p>
  <p>If I use annotateImage - everything is nice.
  If I use newPseudoImage and LABEL - everything is nice.
  The problem appears only with newPseudoImage and CAPTION (but I have to CAPTION, cause I need to scale my headings depending on their length).</p>
  <p>At the same time I have to use these entities in headings (i.e. <code>&amp;nbsp;</code> to avoid wrapping of the dash to the next line).</p>
  <p>Some headings shows nice:
  'Путешествие в Карелию' - is fine, but 'Нуорунен в Карелии' - shows with error.</p>
  <p>My code:</p>
  <pre><code>$postTitle = 'Нуорунен в&amp;nbsp;Карелии';
  $postTitle = html_entity_decode($postTitle);
  
  $mainImage = new Imagick('source.jpg');
  $title = new Imagick();
  $colorize = new Imagick();
          
  $mainImage-&gt;setImageCompressionQuality(85);
  
  $title-&gt;setBackgroundColor('transparent');
          
  $title-&gt;setFont('/fonts/roboto-slab_semibold.ttf');
  $title-&gt;setGravity(imagick::GRAVITY_CENTER);
  $title-&gt;newPseudoImage( 780, 480, &quot;CAPTION:&quot; . $postTitle );
      
  $colorize-&gt;newImage(1, 1, new ImagickPixel('#f8bb00'));
  $title-&gt;clutImage($colorize);
  $colorize-&gt;destroy();
      
  $mainImage-&gt;compositeImage($title, imagick::COMPOSITE_DEFAULT, 210, 110);
          
  $mainImage-&gt;writeImage('image.jpg');
  </code></pre>