escaping

How do you escape a file system path for the iPhone?

Hey everyone, Is there a system library for escaping a file system path for iPhone development? I have to read and write files where the file name is based on 3rd party values so I want to make sure the paths I'm actually writing to are nice and safe. I would have thought there was an NS library that would do this for me, since this is...

Square brackets in XML?

In an XML document, how do I treat square brackets (] or [) ? ...

How do I apply a shell command to many files in nested (and poorly escaped) subdirectories?

Hi! I'm trying to do something like the following: for file in `find . *.foo` do somecommand $file done But the command isn't working because $file is very odd. Because my directory tree has crappy file names (including spaces), I need to escape the find command. But none of the obvious escapes seem to work: -ls gives me the spa...

LINQ to SQL column has keyword as column name, how to quote/escape

In a LINQ to SQL statement I've got a column name in the database that's also a C# keyword (void). How do I get the compiler to treat this as an object property and not the keyword? I could re-write this in with the method notation, sure, but there's got to be a way to give the compiler a hint here... var p = from c in mytable ...

How to escape @ characters in Subversion managed file names?

For many Subversion operations, appending the '@' symbol to the end of a file or URL argument allows you to target a specific revision of that file. For example, "svn info test.txt@1234" will give information about test.txt as it existed in revision 1234. However, when the name of the file contains an @, it is incorrectly interpreted b...

PHP: Escape Quotes ONLY outside of HTML tags (Regex)

What regular expression can identify double quotes outside of HTML tags (which already will be validated) to escape them to "? ...

Escape a string

I'm writing a shell script and I want to escape a string. Is there any way to convert this: I'm happy. You're sad. to I\'m happy.\nYou\'re sad. I'm pretty sure there's some combination of sed/awk that does this.... Thanks ...

Xml Escaping/Encoding terminology

I'm confused as for the difference between the terms "escaping" and "encoding" in phrases like: Xml Encoding Xml Escaping Encoded Html Escaped Url ... Can anyone explain it to me? ...

How can I escape characters in SQLite via bash shell?

I am trying to send a query to SQLite from the command line using bash. I need to escape both single quotes and double quotes, and escape them so that bash does not misinterpret them. Here is a typical query: select * from contacts where source = "Nancy's notes"; How can I send this query from the command line? The basic syntax is som...

How to avoid the ding sound when Escape is pressed while a TEdit is focused?

In code I have developed some years ago I have been using this a lot to close the current form on pressing the Escape key at any moment: procedure TSomeForm.FormKeyPress(Sender: TObject; var Key: Char); begin if key = #27 then close; end; This behaviour is defined for the TForm. The form's KeyPreview property is be set to True to ...

C# HttpWebReqest - escape POST content?

When I've uploaded content from my C# app to a website in the past, I've used a POST request like so: HttpWebRequest wr = (HttpWebRequest)WebRequest.Create("http://" + this.server + "/log.php"); wr.Method = "POST"; wr.ContentType = "application/x-www-form-urlencoded"; string paramString = "v=" + this.version + "&m=" + th...

Escaping Strings in JavaScript

Hello, Does JavaScript have a built-in function like PHP's addslashes (or addcslashes) function to add backslashes to characters that need escaping in a string? For example, this: This is a demo string with 'single-quotes' and "double-quotes". ...would become: This is a demo string with \'single-quotes\' and \"double-qu...

Escape analysis in Java

As far as I know the JVM uses escape analysis for some performance optimisations like lock coarsening and lock elision. I'm interested if there is a possibility for the JVM to decide that any particular object can be allocated on stack using escape analysis. Some resources make me think that I am right. Is there JVMs that actually do it...

single quotes(') Insert problem in sql server 2005 stored procedure

txtname.Text.Trim().Replace("'", "' + char(39) + '") the above statement is not working for stored procedure ...

Standard Function for Escaping Strings in SQL

I'm writing a program in .NET2.0 and I need to escape the inputs before using them. Unfortunately the standard parameter method system does not fully work in the system I'm using. Using the ODBCCommand class I cannot place a ? parameter in the select part of the statement (which is required for the little bit of trickiness I'm doing) w...

Windows XP Indexing Service: escape #, ! or @ ?

Open the search side bar in Windows explorer (Ctrl + F). In the field labeled, "A word or phrase in the file:" enter a query starting with #, ! or @ that you expect to return some results. I get the following error: The Indexing Service query cannot be completed successfully because the volumes you have specified are not indexed Is the...

How to escape-html in JSP before saving to database ?

Hello everyone! I am learning JSP and Java at the moment and wrote a (very) simple guestbook to get started with JSP. But i want to ensure that noone can use CSS, so i need to strip the HTML code before saving it to my mySQL database. I already searched here and found the " PreparedStatement pStmt = conn.prepareStatement("INSERT INTO...

nmake - simple question about escaping

Hi I'd like to make below nmake code to produce check.mak file with the following contents: $(A) instead I get the following error: "NMAKE : fatal error U1040: internal error : macro expansion" Any suggestions? My nmake version is 9.00.30729.01 (VC 2008). OPTION = A FILE = check.mak all : @echo "$$($(OPTION))" > $(FILE) ...

Does all browser engines treat "\<" as "<" and "\>" as ">"?

The main point to make "<" to "\<" and ">" to ">" is to make avoid below inline script: <script> var foo = "</script><script>alert('bug');</script><script>"; // the value of foo is generated from server </script> The string value of foo is generated from server side. So, we plan to change "<" to "\<" and ">" to ">". (I know there i...

Escape Quote in C# for javascript consumption

I have a ASP.Net web handler that returns results of a query in JSON format public static String dt2JSON(DataTable dt) { String s = "{\"rows\":["; if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { s += "{"; for (int i = 0; i < dr.Table.Columns.Count; i++) { ...