title: Store Html.Raw() in a string in Javascript, ASP.NET MVC 3
body: <p>I'm using ASP.NET and I have a string of HTML in the database.</p>
  
  <p>I want to get that html into a variable on the client.</p>
  
  <p>If I do this:</p>
  
  <pre><code>var x = '@Html.Raw(myModel.FishValue)'
  </code></pre>
  
  <p>it works fine, because it's essentially doing</p>
  
  <pre><code>var x = '&lt;p&gt;hello!&lt;/p&gt;';
  </code></pre>
  
  <p>however if there are quotes in the html it breaks the page.</p>
  
  <p>My initial guess would be to .Replace the raw string to add escapes to the quotes, however both <code>.ToString()</code> and <code>.ToHtmlString()</code> (as Html.Raw returns an IHtmlString) do not produce the same markup as simple <code>Html.Raw()</code>.</p>
  
  <p>So I'm at a loss of what best to do.</p>