escaping

Command prompt having trouble escaping quotes and braces

Deadly 提交于 2019-12-30 00:27:08
问题 I am trying to execute the following line in command prompt: curl -X POST -d '{ "method" : "account_info", "params" : [ { "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"} ] }' http://s1.ripple.com:51234 However, I get the following: curl: (6) Could not resolve host: method curl: (7) Failed connect to :80; No error curl: (6) Could not resolve host: account_info, curl: (6) Could not resolve host: params curl: (7) Failed connect to :80; No error curl: (3) [globbing] illegal character in range

unescape unicode from input

删除回忆录丶 提交于 2019-12-29 09:19:09
问题 I am reading line by line from standard input with Scanner, then i print these lines to standard output. But, i need to convert escaped Unicode characters like \u00fd to actual character. Is there any way how to do it? 回答1: I recommend http://commons.apache.org/lang/api-2.4/org/apache/commons/lang/StringEscapeUtils.html. 来源: https://stackoverflow.com/questions/5479728/unescape-unicode-from-input

Using JS - jQuery, how can I unescape html and put `quotes & <>` back in the string?

会有一股神秘感。 提交于 2019-12-29 08:46:10
问题 Essentially I want to undo the escapeHTML() function I found below, after I used it. function escapeHtml(unsafe) { return unsafe .replace(/&/g, "&") .replace(/</g, "<") .replace(/>/g, ">") .replace(/"/g, """) .replace(/'/g, "'"); } function unescapeHtml(safe) { return safe .replace("&", /&/g) .replace("<", /</g) .replace( ">", />/g) .replace(""", /"/g) .replace("'", /'/g); } var a = escapeHtml("<div> yo & yo squirrl's </div>"); var b = unescapeHtml(a); console.log(a); console.log(b);//should

How to use both single and double quotes inside JSTL/EL expression?

偶尔善良 提交于 2019-12-29 08:45:12
问题 I want to call fn:replace inside EL inside c:out to replace quote caracters. The following does not work <c:out value="${fn:replace(userName,'"','\\"')}"/> because XML parser stops at first double quote and sees no c:cout tag termination (JSP compilation stage error). The following <c:out value="${fn:replace(userName,'"','\\"')}"/> does not work, probably because replace function does not see actual quote character. 回答1: Parameterize them with <c:set> . <c:set var="search" value='"' /> <c:set

sed, foward slash in quotes

徘徊边缘 提交于 2019-12-29 08:11:06
问题 I'm trying to do something in bash with sed that is proving to be extremely difficult. I have a bash script that takes as its first argument a date. The code want to change a line in a text file to include the passed date. Here's the code #!/bin/bash cq_fname="%let outputfile="/user/cq_"$1".csv";" sed "29s/.*/\"$ct_fname\"/" file1.sas > file2.sas This script fails on the third line, I get something about a garbled command. Does anybody know a clever way to get this to work? How can I get a

Escaping a double-quote in inline c# script within javascript

谁都会走 提交于 2019-12-29 07:51:50
问题 I need to escape a double quote in inline c# within javascript. Code is below: if ("<%= TempData["Message"]%>" == "") { // code }; Normally, I would just use single quotes like so: if ('<%= TempData["Message"]%>' == "") { // code }; However, TempData["Message"] has single quotes within it (when it contains a link generated by the Html.ActionLink() helper in ASP.NET MVC). So while I could change all the ActionLink helpers inside TempData["Message"] to tags, it's an interesting problem and

Escaping a double-quote in inline c# script within javascript

为君一笑 提交于 2019-12-29 07:51:06
问题 I need to escape a double quote in inline c# within javascript. Code is below: if ("<%= TempData["Message"]%>" == "") { // code }; Normally, I would just use single quotes like so: if ('<%= TempData["Message"]%>' == "") { // code }; However, TempData["Message"] has single quotes within it (when it contains a link generated by the Html.ActionLink() helper in ASP.NET MVC). So while I could change all the ActionLink helpers inside TempData["Message"] to tags, it's an interesting problem and

PHP equivalent for javascript escape/unescape

╄→гoц情女王★ 提交于 2019-12-29 06:57:08
问题 Let's say I have a string: something When I escape it in JS I get this: %73%6F%6D%65%74%68%69%6E%67 so I can use this code in JS to decode it: document.write(unescape('%73%6F%6D%65%74%68%69%6E%67')); I need the escape function in PHP which will do the same (will encode something to : %73%6F%6D%65%74%68%69%6E%67 ) How to do that ? 回答1: PHP: rawurlencode("your funky string"); JS: decodeURIComponent('your%20funky%20string'); Don't use escape as it is being deprecated. 回答2: rawurldecode('%73%6F

SQLite escape string c++

风流意气都作罢 提交于 2019-12-29 06:19:03
问题 Consider the following code char bar[] = "hello world \"One\", two, 'three'"; char *zSQL = sqlite3_mprintf("INSERT INTO stuff (`foo`) VALUES ('%q');", bar ) ; sqlite3_exec(db, zSQL, 0, 0, 0); sqlite3_free(zSQL); /* Produces a exception error */ The problem is that the quotes are not getting escaped in the SQL statement. If I was programing in PHP I would use a function like sqlite_escape_string to escape the strings before inserting them in the SQL query but I can not seem to find the

SQLite escape string c++

给你一囗甜甜゛ 提交于 2019-12-29 06:18:13
问题 Consider the following code char bar[] = "hello world \"One\", two, 'three'"; char *zSQL = sqlite3_mprintf("INSERT INTO stuff (`foo`) VALUES ('%q');", bar ) ; sqlite3_exec(db, zSQL, 0, 0, 0); sqlite3_free(zSQL); /* Produces a exception error */ The problem is that the quotes are not getting escaped in the SQL statement. If I was programing in PHP I would use a function like sqlite_escape_string to escape the strings before inserting them in the SQL query but I can not seem to find the