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
1 answer

How to properly escape a filtered content variable?

I'm running through the Theme Checker plugin for my Wordpress theme, and I have the following code snippets: 1. Get and show only the first embedded video from the post content: post_content…
Frank Eno
  • 2,581
  • 2
  • 31
  • 54
4
votes
3 answers

PHP Escaping query string variables

I have created a form in my web application which has only a single text field and that field is posted to a PHP page using GET, but I am observing strange behavior. i.e. when I test it on my local server, the text is received as it was written in…
Muhammad Ummar
  • 3,541
  • 6
  • 40
  • 71
4
votes
1 answer

Inconsistent behavior with numeric escape characters in R

I unintentionally ran into this and was wondering if there was an explanation for it. In a toy example I put an escape character in a variable level. library(dplyr) library(gt) mt2 <- mutate(mtcars, cylx = ifelse(cyl == 4, "1\2",…
Mike
  • 3,797
  • 1
  • 11
  • 30
4
votes
1 answer

VS Code Debug console escaping line breaks, support for ipython?

UPDATE: I found out my actual issue is that VSCode does not use ipthon (as far as I can tell) in the debugging console (I am used to sypder). VSCode says it supports Jupiter notebooks but I cannot find any reference to how to use ipthon when…
4
votes
4 answers

Single quotes in sqlite on android

I am getting the value from webservice. Some of my values come with single quotes. Like this sample's sqlite is not supporting single quotes. So I replace them with double quotes. While I then retrieve the value from db, I am not able to parse the…
mohan
  • 13,035
  • 29
  • 108
  • 178
4
votes
3 answers

ASCII to HTML-Entities Escaping in Java

I found this website with escape codes and I'm just wondering if someone has done this already so I don't have to spend couple of hours building this logic: StringBuffer sb = new StringBuffer(); int n = s.length(); for (int i = 0; i < n; i++) { …
MatBanik
  • 26,356
  • 39
  • 116
  • 178
4
votes
1 answer

React dangerouslySetInnerHTML not working when using variable

I'm creating an SPA using React that searches data and displays results. Each result follows the following model { "title": "A Title", "body": " <li>escaped html&nbsp;<strong>that sould be rendered</strong>.</li> …
Rolando Urquiza
  • 1,404
  • 3
  • 17
  • 29
4
votes
1 answer

The backspace escape \b in elixir isn't working

The backspace escape From my experience in C iex> IO.puts("Hello Wor\bld\b!") should actually return "Hello Wol!" With this it means that the \b actually backspaced the character that came before it. So I tried to do this same thing in elixir…
Krafty Coder
  • 91
  • 1
  • 5
4
votes
1 answer

Escape multibyte characters

With Python - I can take a string and return it with multibyte characters UTF-8 escaped: $ python3 -c 'print("hello ☺ world".encode("utf-8"))' b'hello \xe2\x98\xba world' Or unicode escaped: $ python3 -c 'print("hello ☺…
user10624526
4
votes
1 answer

Ant / XML escaping a standalone Quotation Mark in a property value

In my ant build-file there is a property: This property is set via GUI by the user. Later I want to call a java task and put the value of the property "pwd" as an argument to the java…
sarkasronie
  • 335
  • 1
  • 2
  • 15
4
votes
1 answer

Clean method for storing regex strings in python

I want to store a series of pre-tested regexes in a config file, and read and apply them at runtime. However, because they're commonly packed with escape characters, by the time I've loaded them up into memory, and populated them into a dict,…
Thomas Kimber
  • 10,601
  • 3
  • 25
  • 42
4
votes
4 answers

How to escape extended pathname expansion patterns in quoted expressions?

In addition to the basic *, ? and [...] patterns, the Bash shell provides extended pattern matching operators like !(pattern-list) ("match all except one of the given patterns"). The extglob shell option needs to be set to use them. An example: ~$…
akaihola
  • 26,309
  • 7
  • 59
  • 69
4
votes
2 answers

escape less / greater than javascript

I'm having a problem trying to escape some code... Basically, I want to escape "<" and ">" but I want them to APPEAR in my #output div as "<" and ">". Currently, they appear as as "<" and ">" on the page. This is obviously to prevent anyone…
Tim
  • 6,986
  • 8
  • 38
  • 57
4
votes
2 answers

Perfectly forwarding arguments in batch

I have a small python script: # args.py import sys; print(sys.argv) How can I write a .bat wrapper file that forwards all of the arguments to this script? To eliminate my shell from the tests, I'm going to invoke it as: import subprocess import…
Eric
  • 95,302
  • 53
  • 242
  • 374
4
votes
2 answers

Escape json in javascript

Need to escape the following json { "xx": 'a', "yy": "bb" } into the following structure in javascript {\r\n\t\"xx\": 'a',\r\n\t\"yy\": \"bb\"\r\n} I have tried the code suggestion from this link, How to escape a JSON string containing…
Rajesh Kumar
  • 247
  • 1
  • 6
  • 21