Questions tagged [escaping]

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

escaping
Filter by
Sorted by
Tagged with
162 votes
5 answers
52k views

How to escape a pipe char in a code statement in a markdown table?

On GitHub I want to build a table containing pieces of code in Markdown. It works fine except when I put a pipe char (i.e. | ) between the backtick (i.e. ` ) chars. Here is what I want: a |...
Marc de Verdelhan's user avatar
139 votes
11 answers
155k views

Error in strings.xml file in Android

I have declared a long string in string.xml of an application. Declared like this <string name="terms">PLEASE READ THESE TERMS OF USE CAREFULLY BY ACCESSING THIS .................</string&...
Subrat's user avatar
  • 3,968
111 votes
3 answers
83k views

Swift @escaping and Completion Handler

I am trying to understand 'Closure' of Swift more precisely. But @escaping and Completion Handler are too difficult to understand I searched many Swift postings and official documents, but I felt it ...
PrepareFor's user avatar
  • 2,528
61 votes
4 answers
71k views

mysql_escape_string VS mysql_real_escape_string

I know that mysql_escape_string is deprecated from 5.3 but what was the actual difference in mysql_real_escape_string. What I thought was that mysql_real_escape_string is the exact same as ...
RobertPitt's user avatar
  • 57.1k
59 votes
8 answers
45k views

How do I escape a string for a shell command in node?

In nodejs, the only way to execute external commands is via sys.exec(cmd). I'd like to call an external command and give it data via stdin. In nodejs there does yet not appear to be a way to open a ...
Maciek's user avatar
  • 3,362
49 votes
3 answers
120k views

Escape double quote in VB string

I have used following piece of code to execute schtasks command from VB6. While executing it, ignores folder if they contains spaces. For example, "C:\program files\test\test.exe" will be ...
Suriyan Suresh's user avatar
44 votes
8 answers
124k views

How to remove backslash escaping from a javascript var?

I have this var var x = "<div class=\\\"abcdef\\\">"; Which is <div class=\"abcdef\"> But I need <div class="abcdef"> How can I "unescape" this var to remove all escaping ...
BrunoLM's user avatar
  • 99.1k
33 votes
7 answers
41k views

Escape filenames the same way Bash does it

When I use the "tab" key in bash (when you have started to type the filename and you want it to complete), bash escapes the filename correctly, and if I use exactly that "escaped" filename, it works. ...
M.A.G's user avatar
  • 341
31 votes
5 answers
15k views

How to get Uri.EscapeDataString to comply with RFC 3986

The Uri class defaults to RFC 2396. For OpenID and OAuth, I need Uri escaping consistent with RFC 3986. From the System.Uri class documentation: By default, any reserved characters in the URI ...
Andrew Arnott's user avatar
27 votes
5 answers
26k views

What literal characters should be escaped in a regex?

I just wrote a regex for use with the php function preg_match that contains the following part: [\w-.] To match any word character, as well as a minus sign and the dot. While it seems to work in ...
Pelle's user avatar
  • 6,513
27 votes
4 answers
33k views

When should I use escape and safe in Django's template system?

If I have a box where people put comments, and then I display that comment like this...should I escape? {{ c.title }}
TIMEX's user avatar
  • 266k
25 votes
2 answers
15k views

Does C support raw string literals?

C++11 added support for raw string literals, such as: R"foo(A " weird \" string)foo" Does C have such a thing? If so, in what version of the standard? C11? If not, does anyone know if it is being ...
Baruch's user avatar
  • 21.1k
21 votes
3 answers
11k views

Android SAX parser not getting full text from between tags

I've created my own DefaultHandler to parse rss feeds and for most feeds it's working fine, however, for ESPN, it is cutting off part of the article url due to the way ESPN formats it's urls. An ...
brockoli's user avatar
  • 4,566
17 votes
2 answers
78k views

Escaping special characters in cmd

I have a Windows .bat script in which I try to run a command with password in parameter. The password I want to be able to use is ~!@#$%^&*()_+|-=\][{}';:"/.>?,<. From what I've read here, ...
NOtherDev's user avatar
  • 9,552
15 votes
1 answer
10k views

How to escape EL dollar signs?

I wish to write JSP which generates XML file, which has syntax, similiar to XML with EL expressions. In other words, I wish to let JSP to process only my expressions, but leave foreign expressions ...
Dims's user avatar
  • 49.2k
14 votes
6 answers
75k views

How to detect ESCape keypress in Python?

I am running a process in a command window (Windows 7, Python 3.1) where I would like the user to abort the process by pressing Esc key. However, pressing Esc doesn't appear to do anything, the loop ...
Alan Harris-Reid's user avatar
14 votes
5 answers
19k views

Convert string with explicit escape sequence into relative character

I need a function to convert "explicit" escape sequences into the relative non-printable character. Es: char str[] = "\\n"; cout << "Line1" << convert_esc(str) << "Line2" << ...
Michele De Pascalis's user avatar
215 votes
5 answers
49k views

How can you escape the @ character in javadoc?

How can I escape the @ symbol in javadoc? I am trying to use it inside a {@code} tag, which is inside <pre> tags. I already tried the html escape &#64; sequence, but that didn't work.
JayL's user avatar
  • 2,859
84 votes
9 answers
116k views

Escaping single and double quotes in a string in ruby?

How can I escape single and double quotes in a string? I want to escape single and double quotes together. I know how to pass them separately but don't know how to pass both of them. e.g: str = "...
Aleem's user avatar
  • 841
75 votes
2 answers
52k views

Updating closures to Swift 3 - @escaping

I've updated my code to Xcode 8.0 beta 6 but I got stuck with what seems to be about the new non escaping closure default. In the following code Xcode suggests to add @escaping in front of completion: ...
nontomatic's user avatar
  • 2,023
73 votes
2 answers
214k views

Valid JSON giving JSONDecodeError: Expecting , delimiter

I'm trying to parse a json response data from youtube api but i keep getting an error. Here is the snippet where it choking: data = json.loads("""{ "entry":{ "etag":"W/\"A0UGRK47eCp7I9B9WiRrYU0.\"" }...
userBG's user avatar
  • 7,010
63 votes
6 answers
15k views

When did C++ compilers start considering more than two hex digits in string literal character escapes?

I've got a (generated) literal string in C++ that may contain characters that need to be escaped using the \x notation. For example: char foo[] = "\xABEcho"; However, g++ (version 4.1.2 if it ...
Greg Hewgill's user avatar
60 votes
1 answer
79k views

Can I use a single quote in a PowerShell 'string'?

I want to include an apostrophe in my string. Is it possible to do without using double quotes? 'This is a quote. Can`'t I just include a single quote in it?' 'This is another quote that doesn\'t ...
Caleb Jares's user avatar
  • 6,207
57 votes
4 answers
82k views

How do I properly escape data for a Makefile?

I'm dynamically generating config.mk with a bash script which will be used by a Makefile. The file is constructed with: cat > config.mk <<CFG SOMEVAR := $value_from_bash1 ANOTHER := $...
Lekensteyn's user avatar
  • 65.5k
57 votes
6 answers
68k views

How to replace a double backslash with a single backslash in python? [duplicate]

I have a string. In that string are double backslashes. I want to replace the double backslashes with single backslashes, so that unicode char codes can be parsed correctly. (Pdb) p fetched_page '<...
zzz's user avatar
  • 2,574
55 votes
4 answers
63k views

decodeURIComponent vs unescape, what is wrong with unescape?

In answering another question I became aware that my Javascript/DOM knowledge had become a bit out of date in that I am still using escape/unescape to encode the contents of URL components whereas it ...
andynormancx's user avatar
  • 13.6k
47 votes
4 answers
47k views

How to match a single quote in sed

How to match a single quote in sed if the expression is enclosed in single quotes: sed -e '...' For example need to match this text: 'foo'
grigy's user avatar
  • 6,746
45 votes
9 answers
128k views

A good way to escape quotes in a database query string?

I've tried all manner of Python modules and they either escape too much or in the wrong way. What's the best way you've found to escape quotes (", ') in Python?
Jonathan Prior's user avatar
45 votes
3 answers
97k views

How to have quotation marks in HTML input values [duplicate]

I have the following problem - from the server side I get a string like 'hoschi"brother'. I want to put this string into a <input value"MYSTRING" />. This results in something ...
tobi's user avatar
  • 453
43 votes
6 answers
173k views

Adding backslashes without escaping [duplicate]

I need to escape a & (ampersand) character in a string. The problem is whenever I string = string.replace ('&', '\&') the result is '\\&'. An extra backslash is added to escape the ...
Dr. Johnson's user avatar
41 votes
1 answer
78k views

How to escape double quotes in as a parameter to an NUnit TestCase?

I tried writing the following TestCase for an NUnit test written in VB.net: <TestCase("FirstNode", "<node id=\"FirstNode\">")> Public Sub GetNode_GivenSomeNodeId_ReturnCorrectNode(ByVal ...
Kjartan's user avatar
  • 18.8k
41 votes
7 answers
49k views

Escaping strings for use in XML

I'm using Python's xml.dom.minidom to create an XML document. (Logical structure -> XML string, not the other way around.) How do I make it escape the strings I provide so they won't be able to mess ...
Ram Rachum's user avatar
  • 86.2k
38 votes
6 answers
73k views

Java escape HTML

currently I use org.apache.commons.lang.StringEscapeUtils escapeHtml() to escape unwanted HTML tags in my Strings but then I realized it escapes characters with accents to &something;, too, which ...
Balázs Németh's user avatar
36 votes
4 answers
86k views

How to escape a square bracket for Pattern compilation?

I have comma separated list of regular expressions: .{8},[0-9],[^0-9A-Za-z ],[A-Z],[a-z] I have done a split on the comma. Now I'm trying to match this regex against a generated password. The problem ...
Afamee's user avatar
  • 5,260
32 votes
4 answers
42k views

how to unescape XML in java

I need to unescape a xml string containing escaped XML tags: &lt; &gt; &amp; etc... I did find some libs that can perform this task, but i'd rather use a single method that can perform ...
Bas Hendriks's user avatar
31 votes
3 answers
14k views

Ruby gsub doesn't escape single-quotes

I don't understand what is going on here. How should I feed gsub to get the string "Yaho\'o"? >> "Yaho'o".gsub("Y", "\\Y") => "\\Yaho'o" >> "Yaho'o".gsub("'", "\\'") => "Yahooo"
user avatar
29 votes
6 answers
62k views

C# - What does "\0" equate to?

I am playing with Pex and one of the parameters it passes into my method is "\0". What does that mean? My guess is an empty string ("") based on the content of my method. However, if it is the same ...
Vaccano's user avatar
  • 80.3k
28 votes
4 answers
28k views

Ignore escape characters (backslashes) in R strings

While running an R-plugin in SPSS, I receive a Windows path string as input e.g. 'C:\Users\mhermans\somefile.csv' I would like to use that path in subsequent R code, but then the slashes need to be ...
mhermans's user avatar
  • 2,147
27 votes
4 answers
30k views

How do I strip dollar signs ($) from data/ escape special characters in R?

I've been using gsub("toreplace","replacement", myvector) to clean out data in R. While this works for commas and the like, removing "$" has no effect. So if I do gsub("$","",myvector) all the dollar ...
araneae's user avatar
  • 1,555
26 votes
5 answers
196k views

Illegal Escape Character "\"

I want to get the name at the end of a link so I did that if( invName.substring(j,k).equals("\")){ copyf=invName.substring(0,j);} Eclipse said String literal is not ...
Dilllllo's user avatar
  • 458
25 votes
10 answers
66k views

Escaping ' in Access SQL

I'm trying to do a domain lookup in vba with something like this: DLookup("island", "villages", "village = '" & txtVillage & "'") This works fine until txtVillage is something like Dillon's ...
inglesp's user avatar
  • 3,337
20 votes
4 answers
39k views

How to echo a variable containing an unescaped dollar sign in bash

If I have a variable containing an unescaped dollar sign, is there any way I can echo the entire contents of the variable? For example something calls a script: ./script.sh "test1$test2" and then ...
Not22's user avatar
  • 315
19 votes
4 answers
21k views

How do I add HTML code to JSF FacesMessage

By default, every JSF FacesMessage is presented in a single row. I would like to add a HTML line break <br /> to the message itself, so that the message is shown neatly. I tried it like below ...
gekrish's user avatar
  • 2,211
18 votes
1 answer
14k views

Make hibernate backquote all table / column names

I am faced with legacy system written to work with MySQL 5.0 and now need to migrate it to MysQL 5.5 (requirement). I found that one column was named maxvalue, which seems to be system word in MySQL 5....
Boris Strandjev's user avatar
14 votes
1 answer
13k views

Firefox error: Unable to check input because the pattern is not a valid regexp: invalid identity escape in regular expression

I'm using regex pattern matching for HTML5 form validation. The latest version of Firefox gives me an error. I only started seeing this in Firefox 46. I don't think this was a problem in earlier ...
Stephen Ostermiller's user avatar
13 votes
4 answers
16k views

How can I accommodate a string with both single and double quotes inside of it in JavaScript

I have an application, and it is fed some HTML. It then needs to put that HTML into a string. This HTML contains single and double quotes. Is it possible, in javascript, to declare a string with ...
swickblade's user avatar
  • 4,556
9 votes
5 answers
64k views

Handling XML escape characters (e.g. quotes) using JAXB Marshaller

I need to serialize an XML java object to a XML file using the JAXB Marshaller (JAXB version 2.2). Now in the xml object, I have a tag which contains String value such that: "<"tagA> **"<"...
javdev's user avatar
  • 794
7 votes
4 answers
23k views

Replace characters with HTML entities in Java [duplicate]

I want to replace certain characters with their respective HTML entities in an HTML response inside a filter. Characters include <, >, &. I can't use replaceAll() as it will replace all ...
user1448652's user avatar
1 vote
4 answers
3k views

In Python, how do I have a single backslash element in a list?

To start, I'm running Python 3.6 on windows 10. The backslash character in python is a special character that acts as an "escape" for strings. Because of this, it cannot be printed directly. If I ...
Terry Townsend's user avatar
110 votes
10 answers
79k views

Colorize logs in eclipse console

Is there a way to colorize parts of logs in the eclipse console. I know I could send to error and standard streams and color them differently but I'm more looking someting in the lines of ANSI escape ...
Newtopian's user avatar
  • 7,644

1
3 4
5
6 7
29