escaping

Creating an mailto: URL with a URL in the body iPhone SDK

UPDATE: I just found a similar post here: http://stackoverflow.com/questions/730101/how-do-i-encode-in-a-url-in-an-html-attribute-value Please consider the code below: I try to send an email message from within my iPhone app. The problem I encounter is that I want to put a URL in the body of the email. This URL contains two ampersands. ...

Escaping double quotes in JavaScript onClick event handler

The simple code block below can be served up in a static HTML page but results in a JavaScript error. How should you escape the embedded double quote in the onClick handler (i.e. \"xyz)? Note that the HTML is generated dynamically by pulling data from a database, the data of which is snippets of other HTML code that could have either s...

What characters have to be escaped to prevent (My)SQL injections?

Hi, I'm using MySQL API's function mysql_real_escape_string() Based on the documentation, it escapes the following characters: \0 \n \r \ ' " \Z Now, I looked into OWASP.org's ESAPI security library and in the Python port it had the following code (http://code.google.com/p/owasp-esapi-python/source/browse/esapi/codecs/mysql.py): ...

Backslash SelectSingleNode Escape

In Javascript I have an XML DOM. I am trying to select a node within the DOM by using SelectSingleNode. Something like cell.SelectSingleNode(stuff [@attrjunk = 'MATCH']). So what I want to match on has a backslash . What do I replace the MATCH with to match on abc\xyz?? I've tried abc\xyz and abcxyz but neither seems to work unfortu...

At witt's end... Javascript won't replace '\n'!

Hey guys, I've been going at this problem for a solid couple hours now and having zero luck. No clue how this is even possible; I'll try to summarize. I'm using TinyMCE to insert new content to a DB, that content is being sent back as an AJAX response after it is inserted into the DB and then shown on the page, replacing some old cont...

How do I run a process from PHP

I need to start a Unix process by calling a PHP-page through the web. I also need to send some arguments to the PHP-page that gets substituted into the command in a save way. ...

string replacement in page created from template

I've got some aspx pages being created by the user from a template. Included is some string replacement (anyting with ${fieldname}), so a portion of the template looks like this: <% string title = @"${title}"; %> <title><%=HttpUtility.HtmlEncode(title) %></title> When an aspx file is created from this template, the ${title} gets r...

Always escape output in view? Why?

The Zend Framework Manual says the following: 60.3.1. Escaping Output One of the most important tasks to perform in a view script is to make sure that output is escaped properly; among other things, this helps to avoid cross-site scripting attacks. Unless you are using a function, method, or helper that does escaping...

How much sanitizing is needed for Web Services that call Stored Procedures?

I am building a series of web services in VB.Net Each of the web services takes multiple string values, performs some validation/processing then calls a Stored Procedure using Linq to SQL. Some of the string contains user data that is stored in the database: These string values passed from the web service are escaped to trap single quo...

How to hide ANSI colour escape codes from fmt

I use (GNU) fmt to format longer texts with nice (‘optimal’) line breaks. However, if the text contains any ANSI colour escape sequences (which are never displayed, and only serve to colour the text when displaying it), fmt considers these as normal characters, and calculates the wrong line lengths. I’m not sure how good literal escape ...

string escape into XML

Hello everyone, Any C# function which could be used to escape and un-escape a string, which could be used to fill in the content of an XML element? I am using VSTS 2008 + C# + .Net 3.0. EDIT 1: I am concatenating simple and short XML file and I do not use serialization, so I need to explicitly escape XML character by hand, for example...

meta description quotes escape

html code meta tag description, it is generated dynamically and we have quotes in the description part and search engines didn't read everything. it shows until the quotes begins in the search results how to deal with it ...

Oracle pl-sql escape character (for a '&')

While attempting to execute SQL insert statements using Oracle SQL Developer I keep generating a "Enter substitution value" prompt: Insert into AGREGADORES_AGREGADORES (IDAGREGADOR,NOMBRE,URL) values (2,'Netvibes','http://www.netvibes.com/subscribe.php?type=rss\&amp;amp;url='); I've tried escaping the special character in the query us...

How can I escape text for an XML document in Perl?

Anyone know of any Perl module to escape text in an XML document? I'm generating XML which will contain text that was entered by the user. I want to correctly handle the text so that the resulting XML is well formed. ...

How to escape a square bracket for Pattern compilation

Hello guys. am new to regular expression. I have comma seperated list of regular expressions like: .{8},[0-9],[^0-9A-Za-z ],[A-Z],[a-z]. I have done a split on the comma. Now am trying to match of this regex against a generated password. The problem is that Pattern.compile does not like square brackets that is not escaped. Can some plea...

Properly handling spaces and quotes in bash completion

What is the correct/best way of handling spaces and quotes in bash completion? Here’s a simple example. I have a command called words (e.g., a dictionary lookup program) that takes various words as arguments. The supported ‘words’ may actually contain spaces, and are defined in a file called words.dat: foo bar one bar two Here’s my f...

How to escape a hash (#) char in python?

I'm using pyodbc to query an AS400 (unfortunately), and some column names have hashes in them! Here is a small example: self.cursor.execute('select LPPLNM, LPPDR# from BSYDTAD.LADWJLFU') for row in self.cursor: p = Patient() p.last = row.LPPLNM p.pcp = row.LPPDR# I get errors like this obviously: AttributeError: 'pyodbc.R...

Why doesn't C terminate strings with a special escaped string-termination character?

In C, strings are terminated with null ( \0 ) which causes problems when you want to put a null in a strings. Why not have a special escaped character such as \$ or something? I am fully aware at how dumb this question is, but I was curious. ...

Does the img tag's alt attribute require encoding?

In html does the text inside the img tag's alt attribute require encoding/escaping? Non encoded example: <img src="myimg.png" alt="image description" /> Encoded example: <img src="myimg.png" alt="image%20description" /> ...

How can I properly escape JavaScript in JavaScript?

This might be something I can't do but... parent.document.getElementById('<?php echo $_GET['song']; ?>') .innerHTML = '<img src="heart.png" onmouseover="heartOver('');" >'; The onmouseover="heartOver(''); portion breaks my JavaScript. Is there a way to escape the quotes so I can do this? ...