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

Replacing %uXXXX to the corresponding Unicode codepoint in Ruby

I have filenames which contain %uXXXX substrings, where XXXX are hexadecimal numbers / digits, for example %u0151, etc. I got these filenames by applying URI.unescape, which was able to replace %XX substrings to the corresponding characters but…
Konstantin
  • 2,983
  • 3
  • 33
  • 55
4
votes
2 answers

Expanding asterisk in bash

I'm trying to run find, and exclude several directories listed in an array. I'm finding some weird behavior when it's expanding, though, which is causing me issues: ~/tmp> skipDirs=( "./dirB" "./dirC" ) ~/tmp> bars=$(find . -name "bar*" -not \(…
John
  • 3,400
  • 3
  • 31
  • 47
4
votes
4 answers

Triple single quote vs triple double quote in Ruby

Why might you use ''' instead of """, as in Learn Ruby the Hard Way, Chapter 10 Study Drills?
4
votes
4 answers

Ignore str.format(**foo) if key doesn't exist in foo

I am trying to get an email template together. The message content will be dependent on values within a dictionary. However, the dictionary might not contain all the keys each time. This currently is fine as all values are in the dictionary…
4
votes
3 answers

Why is Perl DBI escaping values retrieved from MySQL?

I have a value in MySQL that contains an apostrophe (’) and an ellipsis (...): $ /bin/echo "select alias from url_alias where source = 'node/12024'" | \ mysql --skip-column-names -D…
4
votes
2 answers

Escaping individual characters in a character class

How can I escape individual regex metacharacters in Java? For an Android app, I am working with files that contain many characters that regexes consider to have a special meaning. These include \?.()[*\^+' and -. I will be reading in two files: A…
James Newton
  • 6,623
  • 8
  • 49
  • 113
4
votes
2 answers

Why is newline escape sequence not being converted into newline character?

I'm trying to send an email using codeigniter, and would like the message to span over several lines. $address = $this->input->post('email'); $subject = 'Please complete your registration'; $message = 'Thanks for registering! \n To complete your…
Patrick
  • 1,265
  • 7
  • 21
  • 33
4
votes
5 answers

How to pass a string containing both single and double quotes as a parameter to XSLT in PHP?

I have a simple PHP-based XSLT trasform code that looks like that: $xsl = new XSLTProcessor(); $xsl->registerPHPFunctions(); $xsl->setParameter("","searchterms", $searchterms); $xsl->importStylesheet($xslDoc); echo $xsl->transformToXML($doc); The…
Boaz
  • 25,331
  • 21
  • 69
  • 77
4
votes
2 answers

Rails ApplicationHelper Escaping HTML without return statement

When I write module ApplicationHelper def flash_helper flash.each do |key, msg| content_tag :div, msg, :class => key ## "
" + msg + "
" end end end I do not get anything unless I return the…
Maletor
  • 43
  • 2
4
votes
1 answer

Why does this properly escaped SQL query fail?

Here's the query: INSERT INTO jobemails (jobid, to, subject, message, headers, datesent) VALUES ('340', 'jrhodes@jhu.edu', 'We\'ve received your request for a photo shoot called \'another\'.', 'message', 'headers', '2010-04-22 15:55:06') The…
rhodesjason
  • 4,904
  • 9
  • 43
  • 59
4
votes
1 answer

Don't escape th:content tag in Thymeleaf

I'm currently working in a Spring Boot project with Thymleaf 2.1.3 . I'm adding some meta tags to a page, by doing: The pagename variable is filled in by the controller. This works, but for the fact…
Nick
  • 1,441
  • 11
  • 22
4
votes
1 answer

Writing to a new line of a file in Objective-C

For some strange reason, the \n and \r escape sequences do not seem to be working in my code. I want to write each NSString on a new line of the file, but it just appends it the last string on one line. Here's the code: for (Entry *entry in…
Kulpreet
  • 160
  • 2
  • 14
4
votes
6 answers

Single quotes in schtasks command

I'm trying to use SCHTASKS to create a scheduled task on Windows. The parameters include single quotes. If I create my task manually, it works. In the Windows Task Scheduler GUI, the "Details" (within the action tab) show up like this: powershell…
BSUK
  • 692
  • 1
  • 12
  • 28
4
votes
1 answer

Does posting data with a textarea automatically add slashes to (escape) the text?

Ok, so I'm having a problem with a simple textarea. I'm using a kind of hidden page to easily encode some data using JSON. However, all of my text input is automatically being escaped somewhere and I don't know where. All of my $_POST variables are…
animuson
  • 53,861
  • 28
  • 137
  • 147
4
votes
4 answers

Java: Ignoring escapes when parsing XML

I'm using a DocumentBuilder to parse XML files. However, the specification for the project requires that within text nodes, strings like " and < be returned literally, and not decoded as characters (" and <). A previous similar question,…
Personman
  • 2,324
  • 1
  • 16
  • 27
1 2 3
99
100