Answers.Body: <p>As mentioned in the Discord you are probably looking for the <a href="https://twig.symfony.com/doc/3.x/functions/source.html" rel="nofollow noreferrer">source</a> function.</p>
  
  <p>The reason the include doesn't work is covered in the old PR for (what eventually became) source. It's probably best I link all that discussion than try to put it in my own words here!</p>
  
  <ul>
  <li><a href="https://github.com/twigphp/Twig/issues/1229" rel="nofollow noreferrer">Initial discussion with your problem</a></li>
  <li><a href="https://github.com/twigphp/Twig/pull/1230" rel="nofollow noreferrer">First PR</a></li>
  <li><a href="https://github.com/twigphp/Twig/pull/1257" rel="nofollow noreferrer">Further PR after discussion (the source function as it is now)</a></li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-23T12:35:18.917Z
Answers.LastActivityDate: 2020-03-23T12:35:18.917Z
Answers.UserDisplayName: billythekid
Body: <p>Hey guys i have something odd happening and I don't understand why:</p>
  
  <p>The opening of my template i set a variable <code>{% set text = component.textarea ?? null %}</code></p>
  
  <p>Lower in my template i have the following: <code>{% set text = include('_components/_dataTypes/textarea') %}</code></p>
  
  <p>That template only currently has <code>{{ text }}</code> in it so as of right now doesn't mean much.</p>
  
  <p>Then last in my template i have <code>{{ text|raw }}</code></p>
  
  <p>However characters are still encoded. </p>
  
  <p>I've found that if i remove the include template, even though all it includes is <code>{{ text }}</code> that <code>|raw</code> works. I should note that if i put <code>|raw</code> in the include template, it still does not work. </p>
  
  <p>Why is that? Is it a parse order thing or what's going on there that causes the include to ignore the filter? I should note that using Wordsmith and the <code>|pde</code> filter does work regardless of the include... however characters such as <code>&lt; &gt; ' "</code> etc. are still encoded, where as they are not without the include. </p>
  
  <p>Please help me understand why this is occurring. Thank you.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-15T10:47:00.197Z
Comments.Text: I was asked if i am using Javascript at all in any of these places or if it is all Twig/HTML. The answer is there is ZERO javascript, it is strictly html/twig.
Comments.UserDisplayName: Christopher Healey
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-16T09:22:39.827Z
Comments.Text: Interesting, in all these years I'd never considered setting a variable using the return value of an include. I didn't even know it was possible! I see how that could be helpful, though maybe a macro or embed would work around any parse order issues.
Comments.UserDisplayName: James Smith
Tags: <templating><include>
Title: Encoding special characters even with the raw filter due to include
ThreadText: # Encoding special characters even with the raw filter due to include
  
  (Asked by: username_0 on 2020-03-15)
  
  Hey guys i have something odd happening and I don't understand why:
  
  The opening of my template i set a variable `{% set text = component.textarea ?? null %}`
  
  Lower in my template i have the following: `{% set text = include('_components/_dataTypes/textarea') %}`
  
  That template only currently has `{{ text }}` in it so as of right now doesn't mean much.
  
  Then last in my template i have `{{ text|raw }}`
  
  However characters are still encoded.
  
  I've found that if i remove the include template, even though all it includes is `{{ text }}` that `|raw` works. I should note that if i put `|raw` in the include template, it still does not work.
  
  Why is that? Is it a parse order thing or what's going on there that causes the include to ignore the filter? I should note that using Wordsmith and the `|pde` filter does work regardless of the include... however characters such as `< > ' "` etc. are still encoded, where as they are not without the include.
  
  Please help me understand why this is occurring. Thank you.
  
  **Tags:** templating, include
  
  > **Comments:**
  > **username_0**: I was asked if i am using Javascript at all in any of these places or if it is all Twig/HTML. The answer is there is ZERO javascript, it is strictly html/twig.  
  > **username_1**: Interesting, in all these years I'd never considered setting a variable using the return value of an include. I didn't even know it was possible! I see how that could be helpful, though maybe a macro or embed would work around any parse order issues.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-03-23. Score: 1
  
  As mentioned in the Discord you are probably looking for the [source](https://twig.symfony.com/doc/3.x/functions/source.html) function.
  
  The reason the include doesn't work is covered in the old PR for (what eventually became) source. It's probably best I link all that discussion than try to put it in my own words here!
  
  * [Initial discussion with your problem](https://github.com/twigphp/Twig/issues/1229)
  * [First PR](https://github.com/twigphp/Twig/pull/1230)
  * [Further PR after discussion (the source function as it is now)](https://github.com/twigphp/Twig/pull/1257)
  
  
  ---
  
  