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

Escaped character on Telegram Bot API 4.5 MarkdownV2 gives trouble for hyper link

Telegram Bot API 4.5 comes with new parse mode, MarkdownV2. At the same time these _ * [ ] ( ) ~ > # + - = | { } . ! characters must be escaped with the preceding character \. .replace(/[-.+?^$[\](){}\\]/g, '\\$&') used as solution for adding…
Mo.
  • 26,306
  • 36
  • 159
  • 225
4
votes
1 answer

How to escape * multiply symbol in bash after compiling a kotlin program to java jar that takes args[0] and prints it in the console?

My bash version $ bash --version GNU bash, version 4.4.23(1)-release (x86_64-pc-msys) My java version $ java --version openjdk 13.0.1 2019-10-15 OpenJDK Runtime Environment (build 13.0.1+9) OpenJDK 64-Bit Server VM (build 13.0.1+9, mixed mode,…
Julien Reszka
  • 888
  • 12
  • 25
4
votes
3 answers

Java DOM transforming and parsing arbitrary strings with invalid XML characters?

First of all I want to mention that this is not a duplicate of How to parse invalid (bad / not well-formed) XML? because I don't have a given invalid (or not well-formed) XML file but rather a given arbitrary Java String which may or may not contain…
stonar96
  • 1,359
  • 2
  • 11
  • 39
4
votes
1 answer

Escape and unescape invalid characters

This should be really easy. I have a string that i escape like the following: string originalString = "M&M"; string escapedString = System.Security.SecurityElement.Escape(originalString);//M&M Good so far string unEscapedString =…
Maxqueue
  • 2,194
  • 2
  • 23
  • 55
4
votes
2 answers

But really I need htmlentities on a textarea?

I'd like to know if its really necessary escape my string with htmlentities($str, ENT_QUOTES, "UTF-8") before print on an html textarea. Or automatically this one escape for me the characters?
kwichz
  • 2,363
  • 5
  • 23
  • 25
4
votes
2 answers

XSLT / XML: convert apostrophe to a specific entity string

I'd like to be able to convert an apostrophe to the string ' using XSLT. I've got the following XML King's College I'd like to be able to output the following: King's College I've tried a character…
JimS
  • 1,123
  • 3
  • 14
  • 17
4
votes
1 answer

Inserting special HTML characters into XML

I produce an XML string with this expression in JavaScript: var xml = '' + dom.outerHTML + '' (dom is some node in the document tree.) Later I read this back with: ... = (new…
Lerin Sonberg
  • 623
  • 7
  • 11
4
votes
1 answer

Escape -LiteralPath

I've added PowerShell to my context menu by setting: Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shell\Powershell\command] @="powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'" This works quite well, except for a…
Ash
  • 318
  • 3
  • 14
4
votes
2 answers

'unraw' a string in JavaScript

How can I take a raw string in JavaScript and convert all the escape sequences to their respective characters? In other words, the reverse of String.raw. For example: unraw("\\x61\\x62\\x63 \\u{1F4A9} \\u0041"); // => "abc A"; I tried JSON.parse,…
Ian
  • 5,704
  • 6
  • 40
  • 72
4
votes
2 answers

How to not escape backslash when writing to JSON

I am trying to read a JSON file and add a new key,value pair to it. Then write the JSON file back. Example # Read the JSON and add a new K,V input_file_path = os.path.join(os.path.dirname(__file__), 'test.json') input_file = open(input_file_path,…
yesh
  • 2,052
  • 4
  • 28
  • 51
4
votes
1 answer

Escaping quotes using jackson-dataformat-xml

I need help with jackson-dataformat-xml. I need to serialize List using XmlMapper into the xml with encoding the quotes " → ". But after serializing XmlMapper encodes all other special symbols (<, >, & etc) but ignores quotes (' and ")…
nettleclaw
  • 101
  • 1
  • 6
4
votes
1 answer

How to return early from an iteration on a sequence?

Given a predicate "p", that tells if a solution is good enough. A cost function "f" that tells how good a possible solution is and a function that searches for the "best" (i.e. lowest cost) solution in a sequence of possible solutions. How does an…
Alexander Battisti
  • 2,178
  • 2
  • 19
  • 24
4
votes
2 answers

JSF: How to let #{...} expansion not be escaped?

I have a custom EL function (defined in myfunctions.taglib.xml) which returns a chunk of HTML, I want to copy it verbatim to the output, #{mylib:generateHtml()} however, the expansion of #{...} is always escaped. How…
Lenik
  • 13,946
  • 17
  • 75
  • 103
4
votes
2 answers

Why must I use \x1b not \ to represent an escape character

I've read that \x1b represents the escape character, but isn't '\' by itself the escape character? A tutorial wants me to write write(STDOUT_FILENO, "\x1b[2J", 4); to clear the screen. Why won't '\[2J' do the job?
Luke Kong
  • 71
  • 1
  • 7
4
votes
2 answers

Is there any way to replace double quotes with a backslash in swift

I have a submit form where there are multiple textfields. Whenever user enters text like "Hi, my name is "xyz"", the service does not accept this JSON due to double quotes in my string. Please suggest ways to escape this character. I have tried…
Roshni
  • 153
  • 2
  • 14