Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is no error - you're verifying the string in the debugger, which automatically escapes strings - e.g. <code>"Hello \ Goodbye"</code> will show in the debugger as <code>"Hello \\ Goodbye"</code>.</p> <p>That said, the debugger behaves differently depending on how you view a string (and also whether it's C#/VB of course):</p> <ul> <li>Hover over a string (most common) you'll get the escaped version in a tooltip</li> <li>Watch window/Locals etc also display escaped version</li> <li>If you select the 'Text' visualiser you'll see the unescaped version - <em>which is what you should do to actually verify your string.</em></li> <li>Html visualiser does exactly what it says on the tin :)</li> </ul> <p><em>Update</em></p> <p>Okay, so I've gone a bit further and fired up VS2010, please create a test project and follow it through.</p> <pre><code>[TestMethod] public void TestMethod1() { string a = @"`1234567890-=[]\ ;',./\~!@#$%^&amp;*()_+{}|:""&lt;&gt;?|"; Console.WriteLine("Original:"); Console.WriteLine("{0}", a); string htmlEncoded = System.Web.HttpUtility.HtmlEncode(a); Console.WriteLine("Html Encoded:"); Console.WriteLine("{0}", htmlEncoded); } </code></pre> <p>(obviously I've used a verbatim string initially to avoid having to escape anything except the double quote).</p> <p>Console output of the test is:</p> <pre><code>Original: `1234567890-=[]\ ;',./\~!@#$%^&amp;*()_+{}|:"&lt;&gt;?| Html Encoded: `1234567890-=[]\ ;&amp;#39;,./\~!@#$%^&amp;amp;*()_+{}|:&amp;quot;&amp;lt;&amp;gt;?| </code></pre> <p>Equally if you breakpoint the end of the test and start mucking about with the visualisers:</p> <p>Hover (<code>a</code>):</p> <pre><code>"`1234567890-=[]\\ ;',./\\~!@#$%^&amp;*()_+{}|:\"&lt;&gt;?|" </code></pre> <p>i.e. it's C# escaped in the tooltip and surrounded by quotes.</p> <p>Hover (<code>htmlEncoded</code>):</p> <pre><code>"`1234567890-=[]\\ ;&amp;#39;,./\\~!@#$%^&amp;amp;*()_+{}|:&amp;quot;&amp;lt;&amp;gt;?|" </code></pre> <p>.. again, it's html encoded <strong>and</strong> C# escaped with quotes</p> <p>Text (<code>htmlEncoded</code>):</p> <pre><code>`1234567890-=[]\ ;&amp;#39;,./\~!@#$%^&amp;amp;*()_+{}|:&amp;quot;&amp;lt;&amp;gt;?| </code></pre> <p>.. No c# escaping</p> <p>Html (<code>htmlEncoded</code>):</p> <pre><code>`1234567890-=[]\ ;',./\~!@#$%^&amp;*()_+{}|:"&lt;&gt;?| </code></pre> <p><em>In Times New Roman script of course :)</em></p> <p>Which I believe takes us back to the original string - which also shows that the scenario you're describing can't be the case - unless you have read an escaped string as being "correct", when in fact it's not. Html doesn't require <code>\</code> to be escaped.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload