escaping

Overwrite last line on terminal

别来无恙 提交于 2019-12-03 02:57:15
问题 My bash-script looks as following: echo "Description:" while [ $finishInput -eq 0 ]; do read tmp desc="$desc"$'\n'"$tmp" if [ -z "$tmp" ]; then finishInput="1" fi done echo -n "Maintainer:" read maintainer It reads to the desc var until a empty line is passed. After that, i want to read in other stuff. When executing my current script it looks like this: Description: Line 1 Line 2 Maintainer: I would like to overwrite the last empty line with the "Maintainer:". I searched for a solution but

Is there a better HTML escaping and unescaping tool than CGI for Ruby?

我是研究僧i 提交于 2019-12-03 02:42:45
CGI.escapeHTML is pretty bad, but CGI.unescapeHTML is completely borked. For example: require 'cgi' CGI.unescapeHTML('…') # => "…" # correct - an ellipsis CGI.unescapeHTML('…') # => "…" # should be "…" CGI.unescapeHTML('¢') # => "\242" # correct - a cent CGI.unescapeHTML('¢') # => "¢" # should be "\242" CGI.escapeHTML("…") # => "…" # should be "…" It appears that unescapeHTML knows about all of the numeric codes plus & , < , > , and " . And escapeHTML only knows about those last four -- it doesn't do any of the numeric codes. I understand that escaping doesn't generally need to be as robust

How to use SED to find and replace URL strings with the “/” character in the targeted strings? [duplicate]

只愿长相守 提交于 2019-12-03 02:36:38
问题 This question already has answers here : Trying to escape a / for sed on ubuntu (4 answers) Closed 6 years ago . I'm attempting to use SED through OS X Terminal to perform a find and replace. Imagine I have this string littered throughout the text file: http://www.find.com/page And I want to replace it with this string: http://www.replace.com/page I'm having trouble because I'm not sure how to properly escape or use the "/" character in my strings. For example if I simply wanted to find "cat"

Set » HTML entity in JavaScript's document.title?

别说谁变了你拦得住时间么 提交于 2019-12-03 02:30:34
I'm setting document.title with JavaScript, and I can't find a way to supply » ( &raquo ) without it appearing as literal text. Here's my code: document.title = 'Home » site.com'; If I use &raquo ; in the title tag of the document it works great and displays correctly as », but it seems to be unescaping when I include it in document.title . Any ideas? thanks! Try document.title = 'Home \u00bb site.com'; Generally you can look up your special character at a site like this and then, once you know the numeric code, you can construct a Unicode escape sequence in your JavaScript string. Here, that

Java replace issues with ' (apostrophe/single quote) and \ (backslash) together

喜你入骨 提交于 2019-12-03 02:22:09
问题 I seem to be having issues. I have a query string that has values that can contain single quotes. This will break the query string. So I was trying to do a replace to change ' to \' . Here is a sample code: "This is' it".replace("'", "\'"); The output for this is still: "This is' it". It thinks I am just doing an escape character for the quote. So I tried these two pieces of code: "This is' it".replace("'", "\\'"); // \\ for the backslash, and a ' char "This is' it".replace("'", "\\\'"); // \

How to Git stash pop specific stash in 1.8.3?

半腔热情 提交于 2019-12-03 01:33:42
问题 I just upgraded Git. I'm on Git version 1.8.3. This morning I tried to unstash a change 1 deep in the stack. I ran git stash pop stash@{1} and got this error. fatal: ambiguous argument 'stash@1': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git [...] -- [...]' I've tried about 20+ variations on this as well as using apply instead of pop with no success. What's changed? Anyone else encounter this? 回答1: As pointed out previously, the

Is there a Delphi standard function for escaping HTML?

╄→гoц情女王★ 提交于 2019-12-03 01:16:05
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? I am 99 % sure that such a function does not exist in the RTL (as of Delphi 2009). Of course - however -

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

眉间皱痕 提交于 2019-12-02 23:00:42
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 PHP, but any suggestions, constructions and links are very welcomed. PS. in few word we're looking for

Scala: How can I get an escaped representation of a string?

ぐ巨炮叔叔 提交于 2019-12-02 20:18:13
Basically, what I'd like to do is have: // in foo.scala val string = "this is a string\nover two lines" println(string) println(foo(string)) Do this: % scala foo.scala this is a string over two lines "this is a string\nover two lines" Basically looking for an analog of ruby's String#inspect or haskell's show :: String -> String . This question is a bit old but I stumbled over it while searching for a solution myself and was dissatisfied with the other answers because they either are not safe (replacing stuff yourself) or require an external library. I found a way to get the escaped

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

跟風遠走 提交于 2019-12-02 19:27:01
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 missed something, but none of the following Q&As seemed to address this directly: Delphi decode json