html-encode

php htmlentities to decode textarea

拈花ヽ惹草 提交于 2019-12-01 22:40:34
问题 I have a text area and I would like to take the input of the text area and merge it all together. Everything works fine except that it's escaping the quotes. For example test's is outputted as test/'s To fix this I tried htmlenttries such as, <?php $inputtext= $_POST['textinput']; $encodetext = htmlentities($inputtext); $finaltext = html_entity_decode($encodetext); echo '<p>'.$finaltext .'</p>'; ?> This should work according to the html_entity_decode manual (unless I read it wrong which could

Some chars encoded during POST while others are not

点点圈 提交于 2019-12-01 18:18:57
TL;DR CodeIgniters' Security Class directly manipulates your Globals such as $_POST and it finds file() and file () to be a threat so it HTML encodes it. // config.php from my apps folder is the culprit $config['global_xss_filtering'] = TRUE; Do-It-Yourself (the few, the brave) In CodeIgniter 2.1.4 go to system/core/security.php and line #430-442: /* * Sanitize naughty scripting elements * * Similar to above, only instead of looking for * tags it looks for PHP and JavaScript commands * that are disallowed. Rather than removing the * code, it simply converts the parenthesis to entities *

Some chars encoded during POST while others are not

假装没事ソ 提交于 2019-12-01 17:58:46
问题 TL;DR CodeIgniters' Security Class directly manipulates your Globals such as $_POST and it finds file() and file () to be a threat so it HTML encodes it. // config.php from my apps folder is the culprit $config['global_xss_filtering'] = TRUE; Do-It-Yourself (the few, the brave) In CodeIgniter 2.1.4 go to system/core/security.php and line #430-442: /* * Sanitize naughty scripting elements * * Similar to above, only instead of looking for * tags it looks for PHP and JavaScript commands * that

HTML Encoding Strings - ASP.NET Web Forms VS Razor View Engine

删除回忆录丶 提交于 2019-12-01 15:35:20
I'm not quite sure how this works yet... trying to find documentation. In my existing app I've got two different ways of rendering strings in my View <%: model.something %> <!-- or --> <%= model.something %> The first one is html encoded, and the second one is not. Is there something similarly short in Razor? All I can find is this, which is the encoded version. @model.something I guess the best approach would be to use the Raw extension-method: @Html.Raw(Model.Something) @Model.Something automatically HTML encodes. If you want to avoid HTML encoding (and you want this only if you are

HTML Encoding Strings - ASP.NET Web Forms VS Razor View Engine

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 13:41:16
问题 I'm not quite sure how this works yet... trying to find documentation. In my existing app I've got two different ways of rendering strings in my View <%: model.something %> <!-- or --> <%= model.something %> The first one is html encoded, and the second one is not. Is there something similarly short in Razor? All I can find is this, which is the encoded version. @model.something 回答1: I guess the best approach would be to use the Raw extension-method: @Html.Raw(Model.Something) 回答2: @Model

How do you handle line breaks in HTML Encoded MVC view?

 ̄綄美尐妖づ 提交于 2019-12-01 06:14:15
I am unsure of the best way to handle this. In my index view I display a message that is contained in TempData["message"] . This allows me to display certain error or informational messages to the user when coming from another action (for example, if a user tries to enter the Edit action when they don't have access, it kicks them back to the Index with a message of "You are not authorized to edit this data"). Prior to displaying the message, I run Html.Encode(TempData["message"]) . However, I have recently come into the issue where for longer messages I want to be able to separate the lines

AllowHtml not working for ASP.Net Mvc 3 site

巧了我就是萌 提交于 2019-12-01 05:25:47
We're trying to use the [AllowHtml] decoration on one of our ViewModel properties so that we can avoid the YSOD: A potentially dangerous Request.Form value was detected from the client (RequestText= "<br>" ). when we try to submit html text, like: <br> . We want to then use Server.HtmlEncode within the controller action to prevent attacks, but when we decorate the property with [AllowHtml] it has no affect, and if we try to use [ValidateInput(false)] on the controller action, it has no effect either. We saw a StackOverflow Post saying that in MVC 3 RC2 that you have to add:

HTMLencode HTMLdecode

做~自己de王妃 提交于 2019-12-01 05:23:59
问题 I have a text area and I want to store the text entered by user in database with html formatting like paragraph break, numbered list. I am using HTMLencode and HTMLdecode for this. Sample of my code is like this: string str1 = Server.HtmlEncode(TextBox1.Text); Response.Write(Server.HtmlDecode(str1)); If user entered text with 2 paragraphs, str1 shows characters \r\n\r\n between paragraphs. but when it writes it to screen, just append 2nd paragraph with 1st. While I'm decoding it, why doesn't

How do you handle line breaks in HTML Encoded MVC view?

大憨熊 提交于 2019-12-01 05:03:22
问题 I am unsure of the best way to handle this. In my index view I display a message that is contained in TempData["message"] . This allows me to display certain error or informational messages to the user when coming from another action (for example, if a user tries to enter the Edit action when they don't have access, it kicks them back to the Index with a message of "You are not authorized to edit this data"). Prior to displaying the message, I run Html.Encode(TempData["message"]) . However, I

AllowHtml not working for ASP.Net Mvc 3 site

耗尽温柔 提交于 2019-12-01 03:34:18
问题 We're trying to use the [AllowHtml] decoration on one of our ViewModel properties so that we can avoid the YSOD: A potentially dangerous Request.Form value was detected from the client (RequestText= "<br>" ). when we try to submit html text, like: <br> . We want to then use Server.HtmlEncode within the controller action to prevent attacks, but when we decorate the property with [AllowHtml] it has no affect, and if we try to use [ValidateInput(false)] on the controller action, it has no effect