Escape Character in SQL Server

To escape ‘ you simly need to put another before: ” As the second answer shows it’s possible to escape single quote like this: result will be If you’re concatenating SQL into a VARCHAR to execute (i.e. dynamic SQL), then I’d recommend parameterising the SQL. This has the benefit of helping guard against SQL injection … Read more

What characters must be escaped in HTML 5?

The specification defines the syntax for normal elements as: Normal elements can have text, character references, other elements, and comments, but the text must not contain the character U+003C LESS-THAN SIGN (<) or an ambiguous ampersand. Some normal elements also have yet more restrictions on what content they are allowed to hold, beyond the restrictions imposed by … Read more

Which characters need to be escaped when using Bash?

There are two easy and safe rules which work not only in sh but also bash. 1. Put the whole string in single quotes This works for all chars except single quote itself. To escape the single quote, close the quoting before it, insert the single quote, and re-open the quoting. sed command: sed -e “s/’/’\\\\”/g; 1s/^/’/; \$s/\$/’/” 2. … Read more

Escape quotes in JavaScript

You need to escape the string you are writing out into DoEdit to scrub out the double-quote characters. They are causing the onclick HTML attribute to close prematurely. Using the JavaScript escape character, \, isn’t sufficient in the HTML context. You need to replace the double-quote with the proper XML entity representation, &quot;.

Illegal Escape Character “\”

The character ‘\’ is a special character and needs to be escaped when used as part of a String, e.g., “\”. Here is an example of a string comparison using the ‘\’ character: You can also perform direct character comparisons using logic similar to the following: