title: Escape '@' character in Razor inside variable passed to javascript
body: <p>I have to pass email in variable to javascript. Something like this:</p>
  
  <p><code>&lt;button onclick="Send(email)"&gt;Send&lt;/button&gt;</code></p>
  
  <p>Obviously there is '@' character in email variable which I need to escape because I am getting this error: "Unexpected token ILLEGAL"  </p>
  
  <p>I read these posts: <a href="https://stackoverflow.com/questions/3626250/escape-character-in-razor-view-engine">Escape @ character in razor view engine</a>
  and <a href="https://stackoverflow.com/questions/3626250/escape-character-in-razor-view-engine">Escape @ character in razor view engine</a> but none of them resolve my problem. I don't know, what I am doing wrong.</p>
  
  <p>There is almost everything what I tried with these posts:</p>
  
  <pre><code>&lt;button onclick="Send(@email)"&gt;Send&lt;/button&gt;
  </code></pre>
  
  <p>Result: as expected something@something.com => same error</p>
  
  <pre><code>{ 
   var str = email.Replace("@", ("@@"));
  }
  &lt;button onclick="Send(@email)"&gt;Send&lt;/button&gt;
  </code></pre>
  
  <p>Result: something@@something.com => same error</p>
  
  <pre><code>&lt;button onclick="Send(@:@email)"&gt;Send&lt;/button&gt;
  </code></pre>
  
  <p>Result: Server error: ":" is not valid at the start of a code block</p>
  
  <pre><code>{ 
   var str = email.Replace("@", "&amp;#64;"));
  }
  &lt;button onclick="Send(@email)"&gt;Send&lt;/button&gt;
  </code></pre>
  
  <p>Result: something&amp;64;something.com => Unexpected token ILLEGAL</p>
  
  <pre><code>&lt;button onclick="Send(@(email))"&gt;Send&lt;/button&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&lt;button onclick="Send(@(@email))"&gt;Send&lt;/button&gt;
  </code></pre>
  
  <p>Result: as expected something@something.com => same error</p>
  
  <pre><code>&lt;button onclick="Send(@@email)"&gt;Send&lt;/button&gt;
  </code></pre>
  
  <p>Result: Close one. '@' is escaped and this is rendering onclick="@email", but unfortunately not inside the variable email. </p>
  
  <p>I tried other various option but nothing worked. </p>
  
  <pre><code>&lt;text&gt;&lt;/text&gt;
  </code></pre>
  
  <p>and HttpUtility.Encode HttpUtility.JavascriptStringEncode HttpUtility.HtmlAttributeEncode Http.Raw does't seems to work either. </p>
  
  <p>I will be glad for any advice. Really want to know what I am missing here. Thank you.  </p>