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

How to print an escape character in Ruby?

I have a string containing an escape character: word = "x\nz" and I would like to print it as x\nz. However, puts word gives me: x z How do I get puts word to output x\nz instead of creating a new line?
user9325554
  • 43
  • 1
  • 3
4
votes
1 answer

Postgres - Escaping a Question Mark (?) in a column name

One of the columns in a Postgres DB I inherited has a question mark in the name. When I try to select it, it throws an error > select confirmed? from user_purchases; ERROR: column "confirmed" does not exist LINE 1: select confirmed? from…
user2490003
  • 10,706
  • 17
  • 79
  • 155
4
votes
1 answer

Apache .htaccess: Redirect to an URL containing a hashtag

The URLs https://example.com/moved/ https://www.example.com/moved/ should be redirected to the URL https://my.example.com/#views/settings.php?id=2 via .htaccess. This is what I have tried: RewriteCond %{HTTP_HOST} ^example.com RewriteCond…
Blackbam
  • 17,496
  • 26
  • 97
  • 150
4
votes
2 answers

How to escape special characters in header of curl command

I want to curl a url through REST call. The call requires a authorization header to be sent along with it. The authorization header contains a !(apostrophe) character in it. when I send it it throws the following error. -bash: !FeTSs: event not…
vishnumanohar
  • 671
  • 2
  • 8
  • 14
4
votes
4 answers

Rails 3 and devise escaping mailer templates

I'm using rails 3 and devise for authentication. Translating my mailer templates to anything but the devise default results in html escaping. A particular consequence of this is the confirmation of new account email includes an invalid confirmation…
mark
  • 10,316
  • 6
  • 37
  • 58
4
votes
1 answer

split file in bash after unescaped newline

Given common bash-tools, it is easy to split a big file (in my case a MySQL dump and thus a TSV-file) into smaller parts using the split command. Furthermore, this command supports splitting a file after n new lines (i.e. -l argument). But this…
NaN
  • 3,501
  • 8
  • 44
  • 77
4
votes
2 answers

Objective-C shell escaping

How do you escape arguments for shell commands in ObjectivesC? The ruby library has Shellwords (shellescape for NSString, shelljoin for NSArray, I don't need shellsplit). And I really need an escaped string, I know about NSTask, I don't need to…
tig
  • 25,841
  • 10
  • 64
  • 96
4
votes
3 answers

Escape characters when executing powershell command in batch script

I want to execute powershell command and put it in batch variable The command: for /f "delims=" %%i in ('powershell ^(Get-ChildItem ""\dir\"" -Name | sort-object {\[regex\]::Replace^($_,^'\d+^',{$args\[0\].Value.PadLeft^(20^)}^)} | select -last 1^)…
igor
  • 248
  • 4
  • 16
4
votes
3 answers

Replacing escaped double quotes by double quotes in R

I am writing some html code to an SQL databse using RMySQL (but I guess my problem is rather a general R question than really related to SQL or RMySQL). So I am trying something like this: con <- RMySQL(...) # some connection html <- "
Philipp
  • 479
  • 5
  • 10
4
votes
1 answer

How do I defer backticks (or $()) in a possibly-quoted variable in Bash?

I am trying to get Bash to execute the following minimized example properly: # Runs a command, possibly quoted (i.e. single argument) function run() { $* } run ls # works fine run "ls" # also works run "ls `pwd`" # also works, but pwd is eagerly…
Håvard S
  • 23,244
  • 8
  • 61
  • 72
4
votes
1 answer

Is there a standard JSF way or open source library that allows outputting escaped text but _with_ html formatting?

We have the use case that we need to output text that is a combination of static text and dynamic values from the database, the full text is resolved using message properties with language specific static text blocks. We need to escape the output…
Boris Terzic
  • 10,858
  • 8
  • 45
  • 59
4
votes
1 answer

Unable to escape quotes in terraform when writing cloudwatch subscription filter patterns

I've got the following terraform resource declaration: # Log subscription to lambda resource "aws_cloudwatch_log_subscription_filter" "subscription" { provider = "aws.west" name = "root-monitor" log_group_name =…
4
votes
2 answers

SQL Server : escape punctuation in string

I am exporting data from a SQL Server table to a .csv file, and then I use sp_send_email to email the file with data. My problem is with this value: Cantata Number 212 "Peasants Cantata", BWV 212 The value gets split into two columns in the .csv…
4
votes
3 answers

Unescape the ampersand (&) via XMLStarlet - Bugging &

This a quite annoying but rather a much simpler task. According to this guide, I wrote this: #!/bin/bash content=$(wget "https://example.com/" -O -) ampersand=$(echo '\&') xmllint --html --xpath '//*[@id="table"]/tbody' - <<<"$content" 2>/dev/null…
Ava Barbilla
  • 968
  • 2
  • 18
  • 37
4
votes
5 answers

Understanding input escaping in PHP

One thing that's always confused me is input escaping and whether or not you're protected from attacks like SQL injection. Say I have a form which sends data using HTTP POST to a PHP file. I type the following in an input field and submit the…
Philip Morton
  • 129,733
  • 38
  • 88
  • 97