escaping

How to easily escape a command-line filter

半城伤御伤魂 提交于 2019-12-13 00:37:46
问题 I've seen discussions about performing pipes in Vim of the type :%! cmd1 | cmd2 | ... And it works with :w as well :.w !cat | cat And it works with :r :r !echo hello | cat :r !ls | grep .mp4 But the second I try something more ambitious, like, say, awk , it stops working: :r !ls | awk '{printf "\"%s\"\n", $0}' E499: Empty file name for '%' or '#', only works with ":p:h" I have tried dozens of variations on the syntax to get it to work, including surrounding the entire command-line after !

PowerShell get-childitem cannot handle filename starting with [ character even with escape character

点点圈 提交于 2019-12-13 00:12:45
问题 I have a file in c:\temp directory named as [default].xml. When I issue command: get-childitem "c:\temp`[default].xml" in the powershell console, it returns me nothing. However if I issue this command: get-childitem "c:\temp*default].xml", it works as expected. Why escape character on '[' is not working? 回答1: See get-help about_wildcards The [] are wildcard "globbing" operators. To use get-childitem on files that have those characters, use the -literalpath switch to disable wildcarding of the

How can I escape `@` of password in git URL

好久不见. 提交于 2019-12-12 22:37:13
问题 Excuses: I see this: Escape @ character in git proxy password But It's about http.proxy param, and p%4055 does not work for me about url param. My question: I use git version 1.7.1 My password repository is: p@55 And I use gitlab server, and centos for client. In .git/config file, i have be like this: [remote "origin"] url = http://user:p@55@domain.com:port/repo.git But when I pull it, Gave me this error: error: Couldn't resolve host '55:domain.com' while accessing ... I know about escape @

Sed - replacing a string with a variable full of weird characters

喜欢而已 提交于 2019-12-12 22:05:35
问题 I'm using sed to replace a character in a file with a variable. This variable is basically reading the contents of a file or a webpage which contains multiple hash-like strings like below, which are randomly generated: define('AUTH_KEY', 'CVo|BO;Qt1B|+GE}+h2/yU7h=5`/wRV{>%h.b_;s%S8-p|>qpf]|/Vf@`&[g~*:&'); define('SECURE_AUTH_KEY', '{G2-<^jWRd7]2,?]6hhM^*asg.2C.+k=gf33-m+ZK_{Mt|q*<ELF4|gPjyxtTh!)'); define('LOGGED_IN_KEY', 'jSNo9Z;5d]tzZoh-QQ`{M-&~y??$R({:*m`0={67=+mF?L.e+R{;)+4}qCAAHz=C');

How to escape “code” tag in an XML code block in DokuWiki

爷,独闯天下 提交于 2019-12-12 20:18:19
问题 In a DokuWiki page, I want to show part of an XML file as a highlighted syntax block using the <code xml> tag. The XML also contains a <code></code> tag, so DokuWiki detects it as the end of the block. For example: <code xml> <?xml version="1.0" encoding="UTF-8"?> <root> <code>Some data</code><!-- The sintax highlighted block breaks here --> </root> </code><!-- This one is actually the closing tag --> Is there a way to escape the </code> tag? 回答1: Use the file tag instead: <file xml> <?xml

Escape EL in JSP that represent JSON data

被刻印的时光 ゝ 提交于 2019-12-12 19:39:12
问题 The Spring controller sets: model.addAttribute("myJsonObj", JsonUtils.toJson(myObject)); The JSP has something like: <script> var myObj = ${myJsonObj}; (...) How to properly protect this from any XSS exploit? would break the JSON (double quotes, etc.) What's the right strategy to avoid directly EL in the JSP? 回答1: When JSP output var myObj = ${myJsonObj}; , the behavior is the same as eval the script and cause XSS issue. The solution is output ${myJsonObj} as string, so malicious script will

Ruby — looking for some sort of “Regexp unescape” method

你说的曾经没有我的故事 提交于 2019-12-12 17:34:08
问题 I have a bunch of string with special escape codes that I want to store unescaped- eg, the interpreter shows "\\014\"\\000\"\\016smoothing\"\\011mean\"\\022color\"\\011zero@\\016" but I want it to show (when inspected) as "\014\"\000\"\016smoothing\"\011mean\"\022color\"\011zero@\016" What's the method to unescape them? I imagine that I could make a regex to remove 1 backslash from every consecutive n backslashes, but I don't have a lot of regex experience and it seems there ought to be a

Do not escape special characters on form submit

和自甴很熟 提交于 2019-12-12 17:00:26
问题 I have a form that submits via GET, and one of the hidden fields submits a list of category IDs, separated by comma (1,2,3). When the get query gets to the page it is going, commas become escaped with %2C . I cannot make changes to PHP that parses these values, and they must remain commas. In summary: ?category=1,2,3 works, and ?category=1%2C2%2C3 doesn't. How do I prevent the comma from being encoded? Edit to address the comment, simplified, but gives you the gist: <form method="get" action=

Escaping user data, without magic quotes

梦想的初衷 提交于 2019-12-12 16:25:40
问题 I'm taking a look at how to properly escape data that comes from the outside world before it gets used either for application control, storage, logic.. that kind of thing. Obviously, with the magic quotes directive being deprecated shortly in php 5.3.0+, and removed in php6, this becomes more pressing, for anyone looking to upgrade and get into the new language features, while maintaining legacy code (don't we love it..). However, one thing that I haven't seen is much discussion about theory

What SqlCommand.Parameters.AddWithValue really does?

旧巷老猫 提交于 2019-12-12 16:18:52
问题 What changes SqlCommand.Parameters.AddWithValue() does with the query? I expect that: It replaces every ' character by '' , If a parameter value is a string or something which must be converted to a string, it surrounds the value by ' , so for example select * from A where B = @hello will give select * from A where B = 'hello world' . If a parameter value is something "safe" like an integer, it is inserted in a query as is, without quotes, so select * from A where B = @one would give select *