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 automatically escape control-characters in a Python string

I have strings with control-characters in them, and I want to make them visible (for printing documentation of them, for instance). For example, I have dialect = csv.sniffer().sniff(csvfile.read(1024)) and I want to print the contents…
4dummies
  • 759
  • 2
  • 9
  • 22
4
votes
4 answers

Raw Strings, Python and re, Normal vs Special Characters

I'm encountering confusing and seemingly contradictory rules regarding raw strings. Consider the following example: >>> text = 'm\n' >>> match = re.search('m\n', text) >>> print match.group() m >>> print text m This works, which is fine. >>>…
GHH
  • 191
  • 2
  • 10
4
votes
6 answers

Problem with escape character

I have a string variable. And it contains the text: \0#«Ия\0ьw7к\b\0E\0њI\0\0ЂЪ\n When I try to add it to the TextBox control, nothing happens.Because \0 mean END. How do I add text as it is? UPDATE: The text is placed in the variable…
user348173
  • 8,818
  • 18
  • 66
  • 102
4
votes
3 answers

Preserving Escaped Characters in Python XML Parsing

I'm trying to write a python script that takes in one or two xml files and outputs one or two new files based on the contents of the input files. I was trying to write this script using the minidom module. However, the input files contain a number…
Pyrobug
  • 41
  • 1
  • 3
4
votes
3 answers

PowerShell Nested Here-String

Placing the following within a script will fail: $MyString = @' hello @' '@ bye '@ write-host $MyString The error returned is as follows: At C:\scripts\test.ps1:6 char:1 + '@ + ~~ The string is missing the terminator: '. + CategoryInfo …
Fitzroy
  • 229
  • 2
  • 7
4
votes
3 answers

Escape Number 9 in p:inputmask

I want to prepend +90 (Turkey's phone code) to every phone numbers a user enters. For that reason I am using a mask like this:
Ahmet
  • 908
  • 1
  • 17
  • 26
4
votes
1 answer

How do you escape a semicolon in COMPILE_FLAGS property of cmake?

I need to get this as a result in the preprocessor definitions of the msvc generator: MYPATH=\"d:\\;.\\Lib\" But when I use the following escape sequence in set_source_files_properties: set_source_files_properties(source.c PROPERTIES COMPILE_FLAGS…
David
  • 9,635
  • 5
  • 62
  • 68
4
votes
2 answers

Literally echo the text "on"

I'm writing a windows CMD Batch file, that (for simplified purposes) is supposed to echo every line of this file: Flash your lights on and off The problem is when it gets to the 4th and 6th words, it ends up running echo on and echo off, which…
abelenky
  • 63,815
  • 23
  • 109
  • 159
4
votes
1 answer

Suppress Keyword Expansion in Shell Script

Background A shell script generates a number of Java source files. The source files have a particular header comment that includes Subversion keywords. The goal is to check-in the shell script without changing the source file headers buried…
Dave Jarvis
  • 30,436
  • 41
  • 178
  • 315
4
votes
2 answers

Implementing parser for escape sequences

I'm want to parse a custom string format that is persisting an object graphs state. This is ASP.NET scenario and I wanted something easy to use on the client (JavaScript) and server (C#). I have a format something like…
Peter Oehlert
  • 16,368
  • 6
  • 44
  • 48
4
votes
3 answers

SQL Server 2016 EscapeCharacter problems

So I am generating a JSON file from SQL server 2016 using 'FOR JSON' I have used JSON_QUERY to wrap queries to prevent the escape characters from appearing before the generated double quotes ("). This worked correctly except they are still showing…
Chris
  • 235
  • 2
  • 14
4
votes
1 answer

Is there a standard way to encode a URI component containing both forward-slashes and whitespace in Go?

I'm interacting with an API which takes URI components that may contain both forward-slashes and spaces. I need to percent-encode this URI component so that both the forward-slashes and spaces are properly encoded. Example Go code can be found…
alienth
  • 349
  • 2
  • 8
4
votes
2 answers

How can I decode a URL escape string in C#?

Possible Duplicate: how to decode url param with c# I want to change all those %20 ect. to spaces ect.
liamzebedee
  • 14,010
  • 21
  • 72
  • 118
4
votes
1 answer

PHP: Convert single-quoted string into double-quoted

I need to convert string with unicode \xCODEs into regular string. The issue is that string which I have as input seems to be single-quoted. Is there any way to convert single-quoted string into double? Here's some code for better…
Denis O.
  • 1,841
  • 19
  • 37
4
votes
6 answers

How to display XML source code using HTML with Emacs?

In the HTML file, I need to show some XML code. The problem is that I can't use
..
to show '<' and '>'. What would be the solution for this problem? ADDED From the answer, replacing '<' and '>' to < and> can be a solution. I'm…
prosseek
  • 182,215
  • 215
  • 566
  • 871