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
5 answers

autogenerated sql code: single backslash as an escape character is failing

I'm querying an oracle 9i database with: SELECT * FROM table WHERE column LIKE '%' || ‘someText’ || '%' ESCAPE '\'; and it fails with the error "escape character must be character string of length 1" ( ORA-01425 error), while succeeding in an oracle…
naruu
  • 169
  • 3
  • 16
4
votes
2 answers

How to expand environment variable in python while escaping special characters?

On the host, I have an environment variable with a quote sign in the value, something like: export VALUE_WITH_QUOTE_FROM_OS='quote"value' and when I echo on bash, it's fine #echo $VALUE_WITH_QUOTE_FROM_OS quote"value I have a following json…
cookieisaac
  • 1,357
  • 5
  • 18
  • 35
4
votes
1 answer

Escaping knex mysql query statements

I'm fairly new to knex and databases in general, so this is a beginner question. I found no clear mention in the knex docs about this. Are non-raw knex queries automatically "safe"? Secondly, for raw queries, I have several raw statements similar to…
bendulum
  • 1,777
  • 1
  • 13
  • 18
4
votes
1 answer

How can I replace certain characters with their escaped variants using XSLT?

I'm trying to develop an XSLT stylesheet which transforms a given DocBook document to a file which can be fed to the lout document formatting system (which then generates PostScript output). Doing so requires that I replace a few characters in the…
Frerich Raabe
  • 90,689
  • 19
  • 115
  • 207
4
votes
2 answers

Does these methods of removing '\n' left from fgets differ concerning performance?

I'm currently studying C, if this question seems an easy one or a newbie ones, then you know why. So, I know there are a lot of ways to remove the '\n' left by fgets(), as already discussed on SO here, here and here. I'm going to focus this topic…
Claudio Cortese
  • 1,372
  • 2
  • 10
  • 21
4
votes
1 answer

Groovy JsonSlurper JSON value with escaped quotation marks

I'm developing a small tool written in Groovy which parses JSON strings in emails. Some of these JSON strings have JSON values that contain escaped quotes. For example: { "hello": "world with \"quotation marks\"" } To parse these strings, I am…
Thylossus
  • 302
  • 1
  • 3
  • 11
4
votes
1 answer

Is anyone storing raw SVG data inside mongodb?

I'm working on a project where I'm looking to store raw svg data inside my mongodb. Right now, it appears a bit goofy because I need to escape the svg string like so: { "_id" : ObjectId("4c61e60d4d02da615f175b6e"), "name" : "Triangle", "svg-data" :…
longda
  • 10,153
  • 7
  • 46
  • 66
4
votes
1 answer

How to escape double dollars in a makefile?

Consider a directory containing (only) the 3 files obtained by: echo "foobar" > test1.txt echo "\$foobar" > test2.txt echo "\$\$foobar" > test3.txt (and thus containing respectively foobar, $foobar, $$foobar). The grep instruction: grep -l -r…
Denis Bitouzé
  • 520
  • 6
  • 18
4
votes
1 answer

Ansible escaping double quotes and single quotes

I would like insert a nrpe command in the nrpe.cfg with this ansible command check_tomcat_threads.pl -H localhost -p 30011 -C '"http-bio-30011"' -w 200 -c 50 But the the problem are the '" and "' To set this line in the nrpe.cfg use the command …
Georg Gutsche
  • 452
  • 4
  • 9
  • 17
4
votes
2 answers

Perl: Escaping the double-quotes expanded from a variable

How can I get my $name = 'John "FOO" Rambo'; expanded in rather than
Zloj
  • 2,235
  • 2
  • 18
  • 28
4
votes
2 answers

Unrecognized escape sequence

VS 2005 WinXP I am writing an application that will connect to a samba share. However, in my path I am getting an compile error: unrecognized escape sequence The path I am using is this: string path = "\\Samba\sun005\admin_config\test.txt"; I have…
ant2009
  • 27,094
  • 154
  • 411
  • 609
4
votes
1 answer

How to correctly handle an Unterminated string exception?

I'm using the JSON.org java library to tinker with. At the moment I'm encountering an error because of \n characters: try{ String s = "{\"property:\":\"line1\n,line2\"}"; JSONObject o = new JSONObject(s); …
George Profenza
  • 50,687
  • 19
  • 144
  • 218
4
votes
1 answer

escape "< >" for cmd file from java

In cmd.exe I try this : echo " read "book "" The error is : The system cannot find the file specified. It works with echo "read "book ^"" But if I want to send as argument from java, it will not work: String s4 = "read \"book…
Jimmy
  • 43
  • 3
4
votes
2 answers

What SqlCommand.Parameters.AddWithValue really does?

What changes SqlCommand.Parameters.AddWithValue() does with the query? I expect that: It replaces every ' character by '', If a parameter value is a string or something which must be converted to a string, it surrounds the value by ', so for…
Arseni Mourzenko
  • 50,338
  • 35
  • 112
  • 199
4
votes
1 answer

Rails, why '.to_json' is escaping html entities

This is what happens in a rails console (Rails v4.0.4): irb(main):020:0> "pepe&pepe ".to_json => "\"pepe\\u0026pepe \\u003Cjuan\\u003E\"" This is what happens in a irb console (Ruby 2.0.0p247): irb(main):014:0> "pepe&pepe ".to_json =>…
fguillen
  • 36,125
  • 23
  • 149
  • 210