title: Escaping user input for YAML file
body: <p>I need to write user input to my YAML file. The user input needs to be interpreted as plain text.
  What do I need to escape? How to escape it?</p>
  
  <p>To generate the yaml file i use Symfony's Yaml component. For example:</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>$result = ['key' =&gt; '@text'];
  echo $yaml-&gt;dump($result);
  </code></pre>
  
  <p><strong>Actual output:</strong></p>
  
  <pre><code>key:    '@text'
  </code></pre>
  
  <p>When I load this output with Symfony's yaml service, I get a fatal error: </p>
  
  <blockquote>
    <p>Invalid type for path "key". Expected scalar, but got object.</p>
  </blockquote>
  
  <p><strong>Desired output:</strong> (because @ is an <a href="http://yaml.org/spec/1.2/spec.html#id2774228" rel="nofollow">reserved indicator</a>)</p>
  
  <pre><code>key:    '@@text'
  </code></pre>
  
  <p>This output loads OK and is interpreted as <code>@text</code>.</p>