How can I escape localized string encoding:
如何逃避本地化的字符串编码:
<%= Html.Encode("ÆØÅ") %> from rendering ÆØÅ
is there another way to encode localized strings?
有另一种方法来编码本地化的字符串?
1 个解决方案
#1
That's being encoded twice - are you using this in a HtmlHelper call?
那是两次编码 - 你在HtmlHelper调用中使用它吗?
// this will displayÆØÅ as Html.TextBox encodes the
// value passed to it so it's encoded twice in this line
<%=Html.TextBox("sdfsdf", Html.Encode("ÆØÅ"))%><br />
// this will display ÆØÅ
<%= Html.Encode("ÆØÅ") %><br />
// As will this
<%=Html.TextBox("sdfsdf", "ÆØÅ")%><br />
#1
That's being encoded twice - are you using this in a HtmlHelper call?
那是两次编码 - 你在HtmlHelper调用中使用它吗?
// this will displayÆØÅ as Html.TextBox encodes the
// value passed to it so it's encoded twice in this line
<%=Html.TextBox("sdfsdf", Html.Encode("ÆØÅ"))%><br />
// this will display ÆØÅ
<%= Html.Encode("ÆØÅ") %><br />
// As will this
<%=Html.TextBox("sdfsdf", "ÆØÅ")%><br />