title: Twig escaping HTML and rendering as raw
body: <p>I hope someone can assist me on this issue.</p>
  
  <p>I am pulling details from a database to display on a twig template (using Symfony2) but the way in which it is saved in the db makes it difficult to interpret the HTML.</p>
  
  <p>Basically, the HTML tags are already translated as entities in the table, e.g.:</p>
  
  <pre><code>&amp;lt;p&amp;gt;Bach Flower Crab Apple Remedy:&amp;amp;nbsp;the &amp;quot;cleansing&amp;quot; Remedy can be used both internally and externally&amp;amp;nbsp;&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;
  </code></pre>
  
  <p>And so on. I have researched the rendering options in twig and tried the following (based on me rendering a loop of product descriptions):</p>
  
  <pre><code>{% set strategy = 'html' %}
  {% autoescape 'html' %}
  {{ product.description|escape('html')|raw }}
  {% endautoescape %}
  </code></pre>
  
  <p>and also just:</p>
  
  <pre><code>{{ product.description|raw }}
  </code></pre>
  
  <p>The first method just echoes the existing content (as entities) and the second method just renders the HTML tags to the page as follows:</p>
  
  <pre><code>&lt;p&gt;Bach Flower Crab Apple Remedy: the "cleansing" Remedy can be used both internally and externally.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;...
  </code></pre>
  
  <p>So, as you can see, I cannot find a way to actually interpret the HTML tags in order to display the description as it should be.</p>
  
  <p>Is there a way to do this? I can't do it in the PHP as all it's doing is sending an object to the template which is looped through:</p>
  
  <pre><code>public function showAction(Request $request, $store_id=0)
  {
      $max = 1000;
      $repository = $this-&gt;getDoctrine()-&gt;getRepository('AppBundle:Product');
      $products = $repository-&gt;getProductsByStoreId($store_id,$max);
      $paginator  = $this-&gt;get('knp_paginator');
      $pagination = $paginator-&gt;paginate(
          $products,
          $request-&gt;query-&gt;get('page', 1),
          20
      );
  
      $return['products'] = $pagination;
      $return['categories'] = $this-&gt;getCategories();
  
      return $this-&gt;render('AppBundle:tables:productstable.html.twig', $return);
  }
  </code></pre>