On my site every text is served as UTF-8.
Since nowadays every browser supports unicode characters, I would like to use them as-is.
The asp.net framework is very helpful by replacing any unicode with a Numeric Character Reference, like á. For reference check: http://en.wikipedia.org/wiki/Unicode_and_HTML#HTML_document_characters
Sure, this way the webpage renders correctly in the oldest netscape possible, but for example the google analytics ecommerce module has some trouble understanding these specially coded characters.
Is there a way to globally disable the Numeric Character Reference encoding?
For example I want to write in razor:
<span class="title">@ViewBag.Title</span>
I would want this to show on the output:
<span class="title">Számítástechnika</span>
Not this:
<span class="title">Számítástechnika</span>
I'm not trying to disable the html encoding, so Html.Raw is not a solution, as for example I'm not able to ensure that the @ViewBag.Title will not content something like this:
<span class="title"><script>alert('injected hahahah');</script></span>
So I'm content with the automatic encoding of special html characters. That is not what I want to disable.
I wouldn't want to restructure all the code, and I thought that there should be a "global switch" to disable this kind of behavior in using string parameters in razor. Is there a way to do this?
Also can I explicitly forbid the numeric character references, for example with something like new MvcHtmlString(myString, some parameters) ?