escaping

Cocoon escape query parameters problem

Hello, I'm maintaining Cocoon 2.1 application and I faced serious problem with request parameters. Consider following url: http://myapp.com/somePage.html?param1=&lt;expected_integer_value&gt;&amp;param2=&lt;expected_integer_value&gt; Both param1 and param2 are directly passed into transformer as parameters (<map:parameter />) and th...

Escape Single Quote Characters when Importing to SQLite

Hi everyone. I have a records.txt file like this: INSERT INTO 'blogtitles' VALUES('Kelly's at house'); INSERT INTO 'blogtitles' VALUES('Nice catch!'); When i try to import records.txt into the db: sqlite3 my.db < records.txt It gives an error because of the first line. I have many lines like this in the records.txt file. I need a sed ...

How to detect if a string is encoded with escape() or encodeURIComponent()

Hi guys, I have a web service that receives data from various clients. Some of them sends the data encoded using escape(), while the others instead use encodeURIComponent(). Is there a way to detect the encoding used to escape the data? ...

SSI escape HTML output

When i use SSI directive is there any way to escape variable with HTML entities? <META HTTP-EQUIV="Refresh" CONTENT="10; URL="/index.shtml?r=<!--#echo var="HTTP_REFERER" -->"> Thx in advice! ...

What are the WinXP console cursor control characters in c++?

I need the characters/escape sequences that move the console's cursor position. It would be nice to know the left/right/up/down cursor controls, but if that's not possible, a home (go to the first character of the first line in the console). Thanks in advance. ...

Shellwords.shellescape implementation for Ruby 1.8

While the build of 1.8.7 I have seems to have a backported version of Shellwords::shellescape, I know that method is a 1.9 feature and definitely isn't supported in earlier versions of 1.8. Does anyone know where I can find, either in Gem form or just as a snippet, a robust standalone implementation of Bourne-shell command escaping for ...

Auto Escaping Asp.Net MVC

In an Asp.net Mvc application all string output is unescaped by default either you remember to escape everything with HTTPUtility or you open yourself up to XSS attacks. Now I'm a forgetful guy so I'm looking for a solution that helps me "not forget" to escape all my strings for me. Can anybody share any techniques they've used make es...

How do I escape ampersands in batch files?

How do I escape ampersands in a batch file (or from the Windows command line) in order to use the start command to open web pages with ampersands in the URL? Double quotes will not work with start; this starts a new command line window instead. Update 1: Wael Dalloul's solution works. In addition, if there are URL encoded character...

Backticking MySQL Entities

I've the following method which allows me to protect MySQL entities: public function Tick($string) { $string = explode('.', str_replace('`', '', $string)); foreach ($string as $key => $value) { if ($value != '*') { $string[$key] = '`' . trim($value) . '`'; } } return implode('.', $string); } ...

Regular expression trouble

I've been struggling with getting a working regular expression for a little project of mine. Can anyone help me with a regex that matches anything inside <> symbols, but only when they are not preceded by a \ symbol? For example: <Escaped characters \<\> are right in the middle of this sentence.>, <Here is another sentence.> Must mat...

Is it possible in PHP to escape newlines in strings as in C ?

In C you can continue a string literal in the next line escaping the newline character: char* p = "hello \ new line."; ( My C is a bit rusty and this could be non 100% accurate ) But in php, the backslash is taking literally: $p = "hello \ new line."; I.E. the backslash character forms part of the string. Is there a way to get the C ...

How do I stop rails from escaping values in SQL for a particular column?

I'm trying to manually manage some geometry (spatial) columns in a rails model. When updating the geometry column I do this in rails: self.geom="POINTFROMTEXT('POINT(#{lat},#{lng})')" Which is the value I want to be in the SQL updates and so be evaluated by the database. However by the time this has been through the active record mag...

To escape many _ in LaTeX efficiently

How can you escape _ without the use of \_? This is the example of the question word_a_a_a_a_a_b_c_dd There is one function which you can use for this. However, I cannot remember its name. ...

Escaping single quote in String.Format()

I have been all over the 'tubes and I can't figure this one out. Might be simple. The following String.Format call: return dt.ToString("MMM d yy 'at' H:mmm"); Correctly returns this: Sep 23 08 at 12:57 Now let's say I want to add a single quote before the year, to return this: Sep 23 '08 at 12:57 Since the single quote is...

How to convert characters to HTML entities using plain JavaScript

I have the following: var text = "Übergroße Äpfel mit Würmern"; I'm searching for a Javascript function to transform the text so that every special letter is represented by its HTML entity sequence like this: var newText = magicFunction(text); ... newText = "&Uuml;bergro&szlig;e &Auml;pfel mit W&uuml;rmern"; The function should not...

How to encode UTF8 filename for HTTP headers? (Python, Django)

Hi, I have problem with HTTP headers, they're encoded in ASCII and I want to provided a view for downloading files that names can be non ASCII. response['Content-Disposition'] = 'attachment; filename="%s"' % (vo.filename.encode("ASCII","replace"), ) I don't want to use static files serving for same issue with non ASCII file names but...

Revert escaped characters

I saved some data in the database using mysql_real_escape_string() so the single quotes are escaped like this &#39;. It looks ok in the browser, but how can I convert it back to single quote when I save the text in a txt file? ...

PHP's dom->createTextNode escapes some characthers

I am using dom->createTextNode() in PHP. I see that it automatically escapes characters e.g \/"" etc. According to the PHP's manual this is a standard behavior. Is it possible that it doesn't escape any characters? Thanks. ...

What are all the escape characters in Java?

I know some of the escape characters in Java, e.g. \n : Newline \r : Carriage return \t : Tab \\ : Backslash ... Is there a complete list somewhere? ...

Is there a faster way to escape a string?

I have a method that looks like this: public static String escape(String text) { String r = replace(text, "\\", "\\\\"); r = replace(r, "\r", "\\r"); r = replace(r, "\b", "\\b"); r = replace(r, "\t", "\\t"); r = replace(r, "\n", "\\n"); r = replace(r, "\f", "\\f"); return r; } Is there a faster, less brutal way to...