" instead sign of quote (\")

2019-07-16 14:42发布

问题:

I have writteln asp.net web projet in C#.

The problem is in saving sign of quote " in a database and displaying this again in a page.

For example there is a textbox and I type following:

"abcd"

and save this in DB.

However, when I read this again and display it in a page I see:

"abcd"

So what is a problem here?Does someone know the solution?

the charset I use is utf8 and colattion is utf8generalci

回答1:

Try use HTML decode and encode

HttpUtility.HtmlDecode

Refer http://msdn.microsoft.com/en-us/library/aa332854%28v=vs.71%29.aspx



回答2:

This is actually desired behavior - " is the escaped html entity ". It's a security issue to output literal " as it can enable Cross-Site-Scripting or Cross-Site-Request-Forgery.

// sorry, please note freefaller's correct answer below.