" instead sign of quote (")

岁酱吖の 提交于 2019-12-11 03:08:15

问题


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.



来源:https://stackoverflow.com/questions/12473534/quot-instead-sign-of-quote

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!