escaping

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 {Name1|Value1|Value2|...|ValueN}{Name2|Value1|...}{...}{NameN|...}. In this format I have 3 delimiters, {, }, and |. Fu...

Escaping double quotes with tcsh alias

I'm trying to run the following commands: replace -x "must " A2input.txt replace -x " a" -f -s ## A2input.txt replace -x to -s ## -a A2input.txt replace -x faith -f "unequivocal" A2input.txt And it'd be nice if I could just alias it to something short and simple like "a", "b", "c", "d", etc... However, some of those arguments have a ...

XSLT Transformation Problem with disable output escaping

I have an xml in which i have stored some html under comments like this <root> <node> <!-- <a href="mailto:[email protected]"> Mail me </a> --> </node> </root> now in my Transform Xslt code of mine i am giving XPathNavigator which is pointing to node and in xslt i am passing the comment value of as a paramete...

HTMl Helpers in MVC: How do I render html tags with helper such as ActionLink?

When using ActionLink to render data from database which has HTML tags (ie <p>) incorporated in it, ActionLink escapes the tags. What is the best way to handle this? ...

SQLite3: Insert BLOB with NULL characters in C++

Hi everyone, I'm working on the development of a C++ API which uses custom-designed plugins to interface with different database engines using their APIs and specific SQL syntax. Currently, I'm attempting to find a way of inserting BLOBs, but since NULL is the terminating character in C/C++, the BLOB becomes truncated when construct...

[bash] Escape a string for sed search pattern

In my bash script I have an external (received from user) string, which I should use in sed pattern. REPLACE="<funny characters here>" sed "s/KEYWORD/$REPLACE/g" How can I escape the $REPLACE string so it would be safely accepted by sed as a literal replacement? NOTE: The KEYWORD is a dumb substring with no matches etc. It is not sup...

\\\\$ converted to \$ in jsp template data

I just stumbled unto a weirdness in my JSP code. It seems that a double backslash followed by a dollar or percent symbol gets converted to a single backslash (plus symbol). That is, the following JSP: <%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %> \\# \\$ \\% \\^ gets rendered as: \\# \$ \% \\^ I'm using JD...

How do I decode this text?

I have a friend who has code like this in his wordpress files: Blockquote \x66\x75\x6e\x63\x74\x69 Blockquote And so on... How do I decode this? Is there an online tool to do it? G-Man ...

Safe escape function for terminal output

I'm looking for the equivalent of a urlencode for terminal output -- I need to make sure that garbage characters I (may) print from an external source don't end up doing funky things to my terminal, so a prepackaged function to escape special character sequences would be ideal. I'm working in Python, but anything I can readily translate...

TSQL Like Escape clause

I am trying to filter items with a stored procedure using like. The column is a varchar(15). The items I am trying to filter have square brackets in the name. For example: WC[R]S123456. If I do a LIKE 'WC[R]S123456' it will not return anything. I found some information on using the ESCAPE keyword with LIKE but I do not understand how...

How can I convert JavaScript code into one big Java string

So I have 1000 lines of javascript. I need to turn it into a Java String so that I can output (via System.out.println or whatever). I'm looking for an online tool to escape all the quotes... something geared toward my specific need would be nice as I don't want other special characters changed. Lines like: var rgx = /(\d+)(\d{3...

How to allow my control to detect the Escape key before the DataGridView close my control?

I have a control with an undo feature, when the user press Escape the control will revert the original value. The problem is when I integrated my control to DataGridView. The DataGridView "eats" the Escape key, hence my control cannot detect the Escape key. When I put "return true" on EditingControlWantsInputKey, my control was able t...

How do I encode HTTP GET query strings in Perl?

This question is somewhat related to What’s the simplest way to make a HTTP GET request in Perl?. Before making the request via LWP::Simple I have a hash of query string components that I need to serialize/escape. What's the best way to encode the query string? It should take into account spaces and all the characters that need to be es...

MySQL GROUP_CONCAT escaping

(NOTE: This question is not about escaping queries, it's about escaping results) I'm using GROUP_CONCAT to combine multiple rows into a comma delimited list. For example, assume I have the two (example) tables: CREATE TABLE IF NOT EXISTS `Comment` ( `id` int(11) unsigned NOT NULL auto_increment, `post_id` int(11) unsigned NOT NULL, `na...

Understanding input escaping in PHP

Hi, 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 form: "Hello", said Jimmy O'Toole. If you print/echo the input on the PHP page that rec...

How can I escape special HTML characters in JSP?

Before I go and create a custom tag or Java method to do it, what is the standard way to escape HTML characters in JSP? I have a String object and I want to display it in the HTML so that it appears to the user as is. For example: String a = "Hello < World"; Would become: Hello &lt; World ...

How can I match double-quoted strings with escaped double-quote characters?

I need a Perl regular expression to match a string. I'm assuming only double-quoted strings, that a \" is a literal quote character and NOT the end of the string, and that a \ is a literal backslash character and should not escape a quote character. If it's not clear, some examples: "\"" # string is 1 character long, contains dobule ...

hiding grids using ESC key

Hi, I'm new to WPF. I have like 15 grids on my Window and I have a small menu on which I can click and choose which grid to show up or hide. One grid at a time only. I would like that grid to hode (fade out) when I hit ESC. I have all the animations already, I just need to know what grid is visible (active) at the moment. I don't know h...

How do I textile and sanitize html?

Now i ran into some stupid situation. I want the users to be able to use textile, but they shouldn't mess around with my valid HTML around their entry. So I have to escape the HTML somehow. html_escape(textilize("</body>Foo")) would break textile while textilize(html_escape("</body>Foo")) would work, but breaks various Textile features...

How do I use GNU Screen transparently

I want to use GNU screen in such a way that the user doesn't know it's there. It's to help ensure that a text based management application that I'm writing can only be used by a single user at a time. To guard against against users locking everyone else out by running the application and going, leaving it running when going on holiday, I...