Questions tagged [escaping]

Escaping is the process of applying an alternate meaning to a character or set of characters.

Escaping is used for many purposes, such as providing representations of unprintable characters, changing font colors in terminals, or allowing the inclusion in a string of a character normally used to terminate the string, as well as allowing to output a character to user when that character can be used as a control or markup character.

Some of the more common uses of escaping

  • URL encoding to allow including characters such as / or ?, and others, in URL queries;
  • XML and HTML entities that can be used to encode special characters that, for example, would normally be used for markup purposes.
8924 questions
4
votes
2 answers

node's exec() not working because of a space in the URI name

var exec = require('child_process').exec var cmd = 'C:\\Users\\Johnny Cash\\Desktop\\executeme.exe' exec(cmd, function(e, stdout, stderr) { console.log(e); console.log(stdout); console.log(stderr); }); 'C:\Users\Johnny' is not recognized as…
dsp_099
  • 5,801
  • 17
  • 72
  • 128
4
votes
1 answer

Cross-language string escaping

I have a string in C# that contains an error message. This message could contain single quotes or double quotes or both, but I am free to manipulate the string however I need (as well as the HTML/Javascript). For example, the following messages…
Tonkleton
  • 547
  • 3
  • 14
4
votes
2 answers

Why do you have to escape | and + in grep between apostrophes?

I was under the impression that within single quotes, e.g. 'pattern', bash special characters are not interpolated, so one need only escape single quotes themselves. Why then does echo "123" | grep '[0-9]+' output nothing, whereas echo "123" | grep…
Kev
  • 15,899
  • 15
  • 79
  • 112
4
votes
2 answers

Mysql regex error #1139 using literal -

I tried running this query: SELECT column FROM table WHERE column REGEXP '[^A-Za-z\-\']' but this returns #1139 - Got error 'invalid character range' from regexp which seems to me like the - in the character class is not being escaped, and…
chris85
  • 23,846
  • 7
  • 34
  • 51
4
votes
4 answers

mysql_real_escape_string equivalent for Golang

I would like to escape a value that makes up part of a database query, but I can't use parameterized queries. Does Go have an equivalent of PHP's mysql_real_escape_string I can use to escape the query value?
Kevin Burke
  • 61,194
  • 76
  • 188
  • 305
4
votes
5 answers

Problems checking if string is quoted and adding quotes to string

I am trying to check if a string is quoted by checking the first and last characters of the string. But my script fails when checking for the quote see output: AND was unexpected at this time. below. Code @echo off set mystring=Non quoted…
Angus Comber
  • 9,316
  • 14
  • 59
  • 107
4
votes
5 answers

SyntaxError: EOL while scanning string literal while using backslash escape

I know this is a noob question, but new to Python and trying to understand the following: Why does the backslash escape work without error here: >>> print "this is \\\ a string" this is \\ a string But when I try: >>> print "\\\" I get:…
AdjunctProfessorFalcon
  • 1,790
  • 6
  • 26
  • 62
4
votes
2 answers

escape & in url

How can I escape & (ampersand) in url with the correct replacement in the jQuery function. I have tried .replace("/&/g", "&") .replace("/&/g", "%26") .replace("/&/g", "\&") But nothing is working. If anyone has idea please share with…
alienavatar
  • 277
  • 1
  • 6
  • 19
4
votes
1 answer

Bash quotes disable escaping

I want to run some command, let's name it "test" from my bash script and put there some of params from bash variable. My script: #!/bin/bash -x PARAMS="-A 'Foo' -B 'Bar'" ./test $PARAMS I've got: + PARAMS='-A '\''Foo'\'' -B '\''Bar'\''' + ./test -A…
4
votes
2 answers

Escape character for Location of char in a string: R lang

I'm trying to get the location of \ or / in a string. Below is the code I'm attempting: x <- "6,803.61_l>" gregexpr("\\\", x) which(strsplit(x, "")[[1]]=="\") My problem is when I attempt these codes in Rstudio, I…
Frash
  • 724
  • 1
  • 10
  • 19
4
votes
2 answers

bq tool, bat file | escaping characters not working when CALL

Using bq tool I have no problem escaping the > operator with a caret ^: bq query "SELECT x FROM [presentation_dim.dim_events] WHERE event^>1" However, when I CALL the exact same command through a bat file whe whole thing breaks down. call bq query…
JairoM
  • 43
  • 2
4
votes
2 answers

Delphi / MySql : Problems escaping strings

N00b here, having problems escaping strings. I used the QuotedStr() function - shouldn't that be enough. Unfortunately, the string that I am trying to quote is rather messy, but I will post it here in case anyone wants to paste it into WinMerge or…
Mawg says reinstate Monica
  • 38,334
  • 103
  • 306
  • 551
4
votes
2 answers

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

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…
Tivac
  • 2,553
  • 18
  • 21
4
votes
2 answers

Suppress periods from ending brief description in JAVADOC_AUTOBRIEF

The JAVADOC_AUTOBRIEF setting seems a very nice convenience, so that instead of writing: /// \brief Brief description. /// Brief description continued. /// /// Detailed description starts here. You can write: /// Brief description; brief…
4
votes
1 answer

phppass password with quote marks doesn't validate

When I submit trough a form a password with a quotation mark " and use: $hasher = new PasswordHash(10, FALSE); $hasher->CheckPassword($password_safe, $retrieved_password)); It always fails. But if I specify the $password_safe as $password_safe =…
Marvin
  • 503
  • 2
  • 7
  • 17