escaping

Is there a Delphi standard function for escaping HTML?

时光怂恿深爱的人放手 提交于 2019-12-03 10:45:26
问题 I've got a report that's supposed to take a grid control and produce HTML output. One of the columns in the grid can display any of a number of values, or <Any> . When this gets output to HTML, of course, it ends up blank. I could probably write up some routine to use StringReplace to turn that into <Any> so it would display this particular case correctly, but I figure there's probably one in the RTL somewhere that's already been tested and does it right. Anyone know where I could find it?

How to ignore escape sequences stored in PowerShell string variable?

早过忘川 提交于 2019-12-03 09:52:05
In my PowerShell script, I'm running Select-String over a number of files, looking for a string passed into it via a variable ($id): foreach ($file in (ls "path\to\files")) { $found = $false $found = Select-String -Path $file $id -Quiet if ($found) { break } } Unfortunately, the $id variable sometimes things like "\C" or "\T", which Select-String tries to interpret as escape sequences. These are not valid escape sequences, so Select-String throws an error. They are not intended to be escape sequences (e.g., it could be part of a file path such as "C:\Test"), so how can I prevent PowerShell

How to escape/strip special characters in the LaTeX document?

♀尐吖头ヾ 提交于 2019-12-03 09:51:56
问题 We implemented the online service where it is possible to generate PDF with predefined structure. The user can choose a LaTeX template and then compile it with an appropriate inputs. The question we worry about is the security, that the malicious user was not able to gain shell access through the injection of special instruction into latex document. We need some workaround for this or at least a list of special characters that we should strip from the input data. Preferred language would be

How do I escape a single quote in Ruby?

房东的猫 提交于 2019-12-03 09:38:32
I am passing some JSON to a server via a script (not mine) that accepts the JSON as a string. Some of the content of the JSON contains single quotes so I want to ensure that any single quotes are escaped before being passed to the script. I have tried the following: > irb > 1.9.3p194 :001 > x = "that's an awesome string" > => "that's an awesome string" > 1.9.3p194 :002 > x.sub("'", "\'") > => "that's an awesome string" > 1.9.3p194 :003 > x.sub("'", "\\'") > => "thats an awesome strings an awesome string" but can't seem to get the syntax right. The reason sub("'", "\'") does not work is because

Do jQuery's val() and prop() methods html-escape values?

China☆狼群 提交于 2019-12-03 09:34:10
I can't find anything in the documentation about val() and prop() and escaping. Are they intended to escape values when used as setters? Not really. .val() is used to set a form field's value attribute, so escaping isn't really necessary there. You'll be setting the value via the DOM, so it's not like you're constructing HTML through string concatenation. .prop() , on the other hand, doesn't even interact with attributes at all - just DOM properties, so you don't need to working about HTML escaping their either. Edit: for the sake of clarification, I'm assuming that you're asking this because

How does one escape an apostrophe in db2 sql

孤者浪人 提交于 2019-12-03 09:29:20
I'm looking for the db2 equivalent of T-SQL's: INSERT INTO People (Surname) VALUES ('O''Hara'); Use two apostrophes '' to get a single apostrophe on DB2 too, according to the DB2 Survival Guide . Isn't that working for you? Brabster is correct. You are supposed to escape ' with '' So to insert O'Hara , you will have to write O''Hara Excerpt from: http://www.michael-thomas.com/tech/db2/db2_survival_guide.htm Escape character. To insert a single quote, use 2 single quotes ( '' ). To insert pet's use the following pet''s. Example: insert into MYTABLE (question,answer) values ('What is your pet''s

HTML-Entity escaping to prevent XSS

若如初见. 提交于 2019-12-03 09:14:33
问题 I have some user input. Within my code, I ensure that the following symbols are escaped: & -> & < -> < > -> > OWASP states that there are more chars to be escaped. For attributes, I do another kind of escaping: & -> & " -> " This ensures that all attributes are enclosed by ". This makes me sure about my html-attributes, but not about HTML itself. I wonder if my escaping is sufficient. I've read this post, but I'm still not sure about my concern. (JavaScripts are escaped with the OWASP-Library

Using YQL multi-query & XPath to parse HTML, how to escape nested quotes?

好久不见. 提交于 2019-12-03 08:27:44
The title is more complicated than it has to be, here's the problem query. SELECT * FROM query.multi WHERE queries=" SELECT * FROM html WHERE url='http://www.stumbleupon.com/url/http://www.guildwars2.com' AND xpath='//li[@class=\"listLi\"]/div[@class=\"views\"]/a/span'; SELECT * FROM xml WHERE url='http://services.digg.com/1.0/endpoint?method=story.getAll&link=http://www.guildwars2.com'; SELECT * FROM json WHERE url='http://api.tweetmeme.com/url_info.json?url=http://www.guildwars2.com'; SELECT * FROM xml WHERE url='http://api.facebook.com/restserver.php?method=links.getStats&urls=http://www

How do I convert a string to and from JSON with escaped/special characters using DBXJSON?

你。 提交于 2019-12-03 06:51:05
问题 I'm having trouble converting a string with escaped characters to and from a TJsonString. (I'm using Delphi XE 2, Update 4, Hotfix 1). NOTE: I am familiar with the SuperObject, but my requirements are to use the DBXJSON unit. It looks like the TJSONString is not correctly escaped when returning the JSON representation via the ToString() method. What (if anything) am I doing wrong and how do I correctly convert a string with special characters to/from its correct JSON representation? Perhaps I

Twig with Symfony 2 displaying json encoded variables different between prod and dev

点点圈 提交于 2019-12-03 06:37:32
We're building a Symfony 2 application that sends some data from controller to view: Controller $user = array( 'configuration' => array( 'levels' => array( 'warning' => 0.05, 'danger' => 0.10, ), ), ); return $this->render( 'MyWebsiteBundle:Core:searchResults.html.twig', array( 'userJSON' => json_encode($user) ) ); View <script language="javascript"> user = $.parseJSON("{{ userJSON }}"); </script> Result On dev the result looks like this and works as expected: user = $.parseJSON("\x7B\x22configuration\x22\x3A\x7B\x22levels\x22\x3A\x7B\x22warning\x22\x3A0.05,\x22danger\x22\x3A0.1\x7D\x7D\x7D");