html-encode

How to disable auto-escaping of HTML entities in php \SoapClient?

风流意气都作罢 提交于 2019-12-10 23:06:36
问题 I have to talk to a remote remote SoapServer that has a string field MessageXML where I have to put in unescaped XML that is encapsualated in CDATA. I am trying to use php's default \SoapClient . My $payload looks like this: <![CDATA[<DepartureDate>01/12/2015-01/12/2016</DepartureDate>]]> Yet when requesting the Soap service via: $client->ThatMethod(['MessageXML' => $payload]; I can see that the actual response gets escaped in the process via: $lastRequest = $client->__getLastRequest();

Is there a javascript equivalent of htmlencode / htmldecode from asp.net?

风流意气都作罢 提交于 2019-12-10 17:13:51
问题 The problem is this: You have a textbox, you type in some text, send it to the server. On another page, that value is retrieved and displayed on screen in a textbox and a label. It's important to stop scripting attacks, and asp.net won't let you submit unsafe code, so on submit you javascript replace < with < and the same for > When the values are retrieved from the server, they will come back with < and > which is fine for displaying in the label, but when put into the textbox, they must be

<%: %> Syntax for HTML Encoding in a repeater

你说的曾经没有我的故事 提交于 2019-12-10 16:17:58
问题 Since .NET 4 its possible to use the <%: %> syntax for HTML Encoding of text. In a repeater I use the following syntax to display data <%# DataBinder.Eval(Container.DataItem, "fieldlabel")%> The only way I know of to encode the output in the repeater is by using "Server.HtmlDecode". Is it possible to use the new <%: %> in a repeater just in combination with databinding so that I can remove the ugly HtlmDecode syntax. Or is an extention method my only option to improved the readability? 回答1:

Decode Html-encoded characters during Json deserialization

孤街浪徒 提交于 2019-12-10 15:13:25
问题 I’m using Json.net to deserialize json data received by Web API call. Some fields often have html-encoded characters like " or & How can I have this characters automatically decoded during deserialization? I came to 2 possible solutions: Calling System.Web.HttpUtility.HtmlDecode() in property setter like: public string Title { set { title = System.Web.HttpUtility.HtmlDecode(value); } } Writing custom JsonConverter that calls System.Web.HttpUtility.HtmlDecode() in ReadJson() method: public

Encode HTML before POST

心不动则不痛 提交于 2019-12-10 14:39:21
问题 I have the following script, which encodes some of the value it receives propertly, but it does not seem to encode double quotes. How do I encode the full value properly before posting? function htmlEncode(value){ return $('<div/>').text(value).html(); } The above script give me this: <p>Test&nbsp; <span style="color: #ffffff"><strong><span style="background-color: #ff0000">1+1+1=3</span></strong></span></p> I need it to give me this: <p>Test&nbsp; <span style="color: #ffffff"><strong><span

MVC3 TextBoxFor with encoded text

断了今生、忘了曾经 提交于 2019-12-10 12:59:58
问题 Is there a way to use TextBoxFor helper with encoded text? for example: When using the following helper of MVC3 With Razor view engine : @Html.TextBoxFor(model => model.Description) and the value of model.Description is encoded, for example: <script>alert();'</script> the result is text box with the the encoded string, when the wanted result is text box with the decoded string: <script>alert();'</script> Is there a way to use the MVC TextBoxFor with encoded string instead of using @Html

What's the difference between Android's Html.escapeHtml and TextUtils.htmlEncode ? When should I use one or the other?

别来无恙 提交于 2019-12-10 12:44:58
问题 Android has two different ways to escape / encode HTML characters / entities in Strings: Html.escapeHtml(String), added in API 16 (Android 4.1). The docs say: Returns an HTML escaped representation of the given plain text. TextUtils.htmlEncode(String) For this one, the docs say: Html-encode the string. Reading the docs, they both seem to do pretty much the same thing, but, when testing them, I get some pretty mysterious (to me) output. Eg. With the input: <p>This is a quote ". This is a euro

How does Html.Raw MVC helper work?

两盒软妹~` 提交于 2019-12-08 22:29:36
问题 I use the Html.Raw to print a raw html content, for example when I send some thing like ViewBag.div = "<div> Hello </div>"; from the controller to the view side it does not print a raw html content unless I use the Html.Raw method but if I have an encoded content, like content encoded using jquery and inserted into the database and I want to print it as a raw html content the Html.Raw method does not work and I have to use HttpUtility.HtmlDecode(EncodedContent) before I use Html.Raw so please

Determine if string is encoded HTML via jQuery?

你。 提交于 2019-12-08 18:17:30
I'm working on a validation script, but I'm running into a very particular issue. If a user enters a string that happens to be an encoded html character (like & or & ), it will output as the character (& in this case). My question is this: is it possible to write a function that detemines if a string is an encoded character? So if the user enters one of the two above options, I want to launch a particular function, and if it's a non-encoded character, I want to do something else. Is there a way to do this? By definition, if you do not know whether something is an encoded HTML entity or not you

mvc3 - How to disable htmlencode of symbols from source

我们两清 提交于 2019-12-08 14:54:16
问题 I need to out on my page text from database table. Table field "Text" Contains text with html formatting tags like <p>, <br/> etc... (in table its not encoded!) When i'm trying to output with @Model.Text i see encoded html tags like <p> How can i disable this html-encode. Thank you. 回答1: You can use @Html.Raw(Model.Text) to achieve this. 回答2: If you are using the <%: syntax in your views, it will automatically encode all output. Using <%= does not perform the encoding. More details can be