escaping

Cancel escape-sequence on JavaScript

We can work with escape sequence in strings on JavaScript. For example, I can write \\ and it means \. But I don't want to use a escape sequence. I know that on C# I can write @"My string" and I don't need to escape anything. Is there similar syntax in JavaScript? ...

Escaping a double-quote in inline c# script within javascript

I need to escape a double quote in inline c# within javascript. Code is below: if ("<%= TempData["Message"]%>" == "") { // code }; Normally, I would just use single quotes like so: if ('<%= TempData["Message"]%>' == "") { // code }; However, TempData["Message"] has single quotes within it (when it contains a link generated ...

MySQL: escape space from query

Is there a way using MySQL, to query a value containing a space, but as some sort of escape character? It's for an instant search engine I'm building (I'm trying to incorporate special search strings such as quotes to search for exact string). cheers ...

What's the best way to escape user input for Regular Expressions in MySQL?

I'd like to take user input, denoted as $dangerous_string, and use it as part of a RegEx in a MySQL query. What's the best way to go about doing this? I want to use the user's string as a literal -- if it contains any characters that mean something in MySQL RegEx, those characters should not actually affect my Regular Expression. $dan...

mysql_real_escape_string ISSUE

If I type ' into my search bar I get a mysql error as the "sting" has not been escaped- it think. But the reason why I cant escape it is because I dont think it currently is a string. the search box generates search results dynamically with ajax it is as I type and it finds the results that I get the error: You have an err...

How to obtain consistent javascript prompt string and innerHTML

I have a paragraph, which I would like to edit using javascript prompt function. All work ok while I didn't enter < or >. They looks good in html, but when I would like to edit them again, I see ugly &gt; and &lt; The issues can be easy reproduced via following scenario: press Edit-button, Enter string <<<>>>. press Edit-button again....

How do you properly escape json to be sent over ajax? (Using Datatables)

I would like to know how to properly escape my json code. I am using the datatables plugin and this is the json that is failing. "6\\\\\\\' 5\\\\\\\" Ford HD ", It originally looks like this (without the opening/closing brackets and the comma): 6\\\' 5\\\" Ford HD How would I properly escape this? ...

jinja2 autoescaping

I have String which contains some HTML and I'd like to escape it. After that I need to convert all /n into new lines with: @environmentfilter def filter_newLine(env, value): result = value.replace('\n', '<br/>') if env.autoescape: result = Markup(result) return result I use the the filter {{status|e|filter_newLine}...

Display an escaped Json field with Javascript

How can I read an invalid Json returned string with Javascript (jQuery or not)? For example, the first FirstName will not be displayed as it contains an escaped character. So, I will get : undefined. { "ListOfPersons": [ {"Id":1,"FirstName containing doublequotes (ex: \") ":"Foo","LastName":"Bar"}, {"...

how to escape special characters within eval using javascript?

var input; // method 1 input = document.getElementById('address').value; alert(input) // method 2 eval('input = "'+document.getElementById('address').value+'"') alert(input) method 1 is working fine, but method 2 is not working when newline characters are inputted and it says "unterminated string literal". I need to store values usi...

escaping input in php

hi! I wrote a code.. but now I don't know which version is a better one.. Is there any possibility couse of 1st version my code is vulnerable? Version 1: $destination = $_POST['var']; $destination = strip_tags(trim($destination)); Version 2: $destination = strip_tags(trim($_POST['var'])); ...

Escape Double-Byte Characters for RTF

Hi. I am trying to escape double-byte (usually Japanese or Chinese) characters from a string so that they can be included in an RTF file. Thanks to poster falconcreek, I can successfully escape special characters (e.g. umlaut, accent, tilde) that are single-byte. - (NSString *)stringFormattedRTF:(NSString *)inputString { NSMutableString...

store commas in mysql database

Hello all, I'm trying to store the date in an sql table, but I want it formatted as such: Month day, year October 10, 2010 But whenever I do the sql call, the 2010 gets lost. How can I fix this? $eventdate = "October 10, 2010"; $sql = "INSERT INTO `tims`.`blog` ( `title`, `date`, `post`, `author`, `approved`) \n" . "VALUES...

Keeping code from being exploited, Securing Javascript and Forms

Hi, I am creating a page that allows users access to a certain section of my website if they click 8 out of 25 checkboxes in the right sequence. First of all thanks to Reigel for the orignal code, he took what I had and rewrote it, its way better than what I initialy started with. Also thanks to Peter Ajtai for helping me optimize the c...

How can I assign the 'Close on Escape-key press' behavior to all WPF windows within a project?

Is there any straightforward way of telling the whole WPF application to react to Escape key presses by attempting to close the currently focused widow? It is not a great bother to manually setup the command- and input bindings but I wonder if repeating this XAML in all windows is the most elegant approach? <Window.CommandBindings> ...

How to escape "/" in document name in Documentum DFC/DFS

How to escape "/" when you want to retrieve document like "/Templates/Blank Access 97 / 2000 Database" by object path in Documentum using DFS or DFC? ...

How do I output a literal sequence with NSLog

I want NSLogto output a literal escape sequence, without treating it as a pattern. Take, for example NSLog(@"image%03d.jpg");, who's output I want to be the actual contents, image%03d.jpg instead of image000.jpg. I've tried various escape sequences like NSLog(@"image\\%03d.jpg");, NSLog(@"image\\%03\\d.jpg"); and NSLog(@"image%03\\d.jp...

PHP escaping encoded quotes

I have following piece of code which posts some data into database: $post = trim( $post ); $post = htmlentities( $post, ENT_QUOTES, null, false ); $statement = "INSERT INTO table (row) VALUES (:message)"; $prepared_posts = $pdo->prepare( $statement ); $prepared_posts->execute( array( ':message' => $post ) ); I have MySQL version 5.1....

Match parameter values in string using regex

I have a string containing several parameters, e.g. PARAM1="someValue", PARAM2="someOtherValue"... For log-output I want to "hide" some of the parameter's values, i.e. replace them with ***. I use the following regex to match the parameter value, which works fine for most cases: (PARMANAME=")[\w\s]*" However, this regex only match...

How to escape whitespace in a bash alias?

Tried to set some aliases in my .bashrc file. This one... export alias umusic="/Volumes/180 gram/Uncompressed/" ...gets the following error... -bash: cd: /Volumes/180: No such file or directory ...when I try "cd $umusic". I've tried various methods of escaping that whitespace in the directory name, to no avail. (180\ gram, 180%...