escaping

using mdfind how can I append an mv command to the result and escape spaces?

Using apple os 10.5.x I am trying to hunt down font files and move them on client workstations. So far I have: mv $(mdfind -onlyin ~/Desktop/fontRm/ "kMDItemContentType == '*ont*'" | sed -e 's/ /\\ /g') /Users/chrihopk/Desktop/target/ I'm struggling with getting the sed command to escape the spaces before the mv command executes. Tha...

Escaping quotes from Rails Variables when using them for Javascript?

Hi, I am having problems when trying to use a rails variable within javascript code. For example, I might define a link_to_remote, with parameter :complete => "alert('my_var');" If my_var = "I'm testing.", then the javascript code will break due to the single quote closing the code prematurely. If I try using escape_javascript(my_var)...

How to Prevent the conversion of & to & using XmlTextWriter?

The '&' in the text gets escaped and gets converted to & when creating the xml file using XmlTextWriter but i dont want the conversion to take place how to prevent it? Is there any other way besides using WriteRaw func of xmltextwriter? ...

Adding backslashes without escaping [Python]

I need to escape a & character in a string. The problem is whenever I string = string.replace ('&', '\&') the result is '\\&'. An extra backslash is added to escape the original backslash. How do I remove this extra backslash? ...

Ruby gsub doesn't escape single-quotes

I don't understand what is going on here. How should I feed gsub to get the string "Yaho\'o"? >> "Yaho'o".gsub("Y", "\\Y") => "\\Yaho'o" >> "Yaho'o".gsub("'", "\\'") => "Yahooo" ...

Getting correct string length in Python for strings with ANSI color codes

I've got some Python code that will automatically print a set of data in a nice column format, including putting in the appropriate ASCII escape sequences to color various pieces of the data for readability. I eventually end up with each line being represented as a list, with each item being a column that is space-padded so that the sam...

php escaping when I don't need it to

hi, I've got an issue whereby PHP is escaping where I really don't want it to in this code: $url_ = stripslashes(((substr(strtolower($url),0,7)!="http://")? "http://".$url:$url)); $host = $this->googleDomains[mt_rand(0,count($this->googleDomains)-1)]; $target = "/search?"; $querystring = sprintf("client=n...

How can I tell bash to properly escape expanded strings?

Suppose I have a directory containing the files foo bar.txt foo baz.txt (each with a space between 'o' and 'b'). Suppose I would like to do this: for f in *.txt; do mv ${f} `basename ${f} .txt`; done This fails because bash expands *.txt to foo bar.txt foo baz.txt instead of foo\ bar.txt foo\ baz.txt i.e. properly escaped ...

How do you break long string lines in Scheme?

For example, I want to break the long string in the below panic statement: (panic "Truth-assignment length is longer than the number of propositions!") I have tried (panic "Truth-assignment length is longer than the number \ of propositions!") and (panic "Truth-assignment length is longer than the number of propositions!") and they both ...

String value with an appostrophe in a PHP variable email address, mysql select

I have an email address mike.o'[email protected] stored in a posted variable and I want a select statement in mysql to validate the existance of the email address and retrieve a password from my table. My query gets stuck at the apostophe when it trys to execute. eg "SELECT pwd FROM tbl_users WHERE userName = '$email'"; Any assistance wi...

How can I convert unsafe characters to safe characters for XML in Java?

I have Finnish characters in my text (for example ä, ö and å) that are unsafe in XML, is there any library/framwork for this purpose? ...

Is there any C SQLite API for quoting/escaping the name of a table?

It's impossible to sqlite3_bind_text a table name because sqlite3_prepare_v2 fails to prepare a statement such as: SELECT * FROM ? ; I presume the table name is needed to parse the statement, so the quoting needs to happend before sqlite3_prepare_v2. Is there something like a sqlite3_quote_tablename? Maybe it already exists under a n...

Escaping XSLT regular expression

I am having some trouble escaping a validation expression within a regular expression validator in XSLT. <asp:RegularExpressionValidator ID="regValEmail" ErrorMessage="..." runat="server" ValidationGroup="Store" ValidationExpression="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\....

Escaping jQuery data being sent via POST

I'm using jQuery.ajax to extract form data from a page, and send it to my database (via another PHP page). The form information is collected by: var X=$('#div1').val(); var Y=$('#div2').val(); This is used to build the POST string, i.e. var data='varx='+X+'&vary='+Y; Obviously this is problematic if an ampersand character is used....

Escaping double quotes (PHP)

I want to escape double quotes from this string: <li><a href="the_permalink()">the_title()</a></li> The following works fine: echo '<li><a href="'; echo the_permalink(); echo '">'; echo the_title(); echo '</a></li>'; ... but how do I get them all in one single statement? Thanks ...

XSL: Include some ASCII chars when method="text"

I've got an XSL template that outputs text as opposed to XML. In this text, I need to include ASCII character 0x10 in certain position. I understand this character is not allowed in an XML document, but I'm going to output text, so why am I not allowed to use it anyway? I also understand it will not be possible to put this character li...

output code AS IS

add in note i have to paste 3 time the following code in the html body of a static webpage, instead of having to paste it and have a lot of code, i prefer to only have one line (3 times) that call the writing of the code, like this : <?php getgooglepub(); ?> I like to make a php function that will ouput to the hmtl page the google ana...

How do I escape a semicolon in VB script?

I have a vbscript file that is reading a file and sending each line to a terminal program. When it comes to a semicolon in the middle of the string, it splits the semicolon at the string. I have been using this code for quite sometime with other strings with no problems. There is one string per line in the file the script is reading....

Double-Quotes in start line of Windows Batch script

I have looked at the answers already provided, but I'm still stuck. Here is what I currently have: start "" "C:\Program Files (x86)\Spark\Spark.exe" echo Spark started This works fine. But now I want to pass parameters to the client, which must be wrapped in quotes. I can do the following on the command line: "C:\Program Files (x8...

JavaScript removes slash from JSP variable

Have JSP variable ${remoteFolder} It's value is \\file-srv\demo Use jQuery embedded in this JSP. jQuery resolves ${remoteFolder} variable as \file-srvdemo ,i.e. one slash is removed. How to remain initial value of this var? edited: when ${remoteFolder} is used inside form tag, that it resolved OK. edited2: JS part of JSP, slashes ...