I'd like to use some server tags inside a Javascript function:
<%=Model.HtmlProperty%>
In the past I have stored this value in a hidden input field, but when a property contains HTML you get problems with special characters such as quotes. I would like to avoid having to encode and decode in the controller to avoid problems with special characters.
Rick Strahl has a couple posts on this problem in a web forms project, but I'm looking for an elegant solution for an MVC project.
UPDATE: Robert Harvey's answer below suggests to encode the html. Again, that isn't what I want to do. Ultimately, I'm trying to inject html script into an fckeditor instance. This must be done in javascript. I'm trying to figure out how to access the value of <%=Model.HtmlProperty%>
inside javascript without storing encoded text in a hidden input element.