escaping

how to simulate a escape key at the end of a key sequence in c++?

how to simulate a "escape key" as if an escape key has been pressed, at the end of a string sequence in c++? i need to provide the stdin input, which accepts string data until Escape key is pressed, for that it receives the characters correctly, but how do i send an 'escape key stroke' finally? ...

php xpath dealing with apostrophe / single quote in searched text

In my PHP script, I'm using XPATH to search nodes for text. Everything works swimmingly -except - when I search for a word with an apostrophe. basically my code looks like this $keyword = $_GET['keyword']; ...snip... $xml = simplexml_load_file($data); $search = strtolower($keyword); $upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; $lower =...

Write MIME file with double-quotes

I am manually creating a multi-part MIME-formatted file and submitting it to an SMTP pickup directory. When the email arrives in my inbox it has lost the opening double-quote of any double-quote terms. e.g. <html lang="eng"> becomes <html lang=ng"> I have checked the file before it is submitted to SMTP (PowerMTA) and it does cont...

HTMLPurifier dies when the following code is run through it.

Using the latest release of HTMLPurifier with default configs. The following code will cause the oh-so-lovely blank white page in PHP. Am I missing something? Even if I set HTML.TidyLevel to light or none it still breaks. Here is a partial log of the errors thrown when trying to purify the code below: http://pastie.org/private/13f0htscq...

Tomcat(6) escapes text from beans before including it to resultig html

When I get from MyBean some text, for example, <p>Hello world</p> and include it into jsp via jsp:getProperty in resulting html page it will be &lt;p&gt;Hello world&lt;/p&gt; I could guess that tomcat's team did this due to security reasons but it's not behaviour that I want to get. Q:how to get needed behaviour? UPD: @Jörn Horstman...

Single quoted Ruby strings -- inconsistent escaping

Why do the following strings give me the same output in the Ruby interpreter? 'f:\new' 'f:\\new' Both strings result in: "f:\\new". I was expecting the second string to display "f:\\\\new" (if not that, then the first one should have shown "f:\new") ...

Is there a better way to double escape (or escape twice) user input in BASH than calling printf twice?

This script will read an old and a new value from the user and then use sed to find and replace them in a file. For example if I entered T*T*z and B*B*z it would look for T\*T\*z in the file and replace with B\*B\*z. It works but I've been trying to make this more concise. I don't have any need for the intermediate variables $ESC_OL...

How can I capture terminal arrow keys in ruby?

How can I capture arrow keys in a terminal without the user having to press "enter" after the arrow key? ...

What's the C escape sequence for blanks?

I'm writing a program to count blanks, tabs, and newlines. I remember what the escape sequence for tabs and newlines are, but what about blanks? \b? Or is that backspace? ...

Rails: base64 and character escaping problem

In my app I need to encode a string via base64, escape it's possible special characters and put it into a URL. I do the following: string = "[email protected]" enc = OpenSSL::Cipher::Cipher.new('DES-EDE3-CBC') enc.encrypt('dummy_salt') encoded = URI.escape(Base64.encode64(enc.update(string) << enc.final)) The problem is, that ...

Preventing a database from rejecting user input

I'm making a simple interface that will allow a user to modify pieces of CSS and HTML which are stored in a Microsoft SQL database. This interface uses PHP5 and ADOdb. For some reason this form will reject any input which contains one or more single quotes. This string, for example, is not allowed: "background-image:url('paper.gif');" ...

Regex: How to replace with the string literal "\1"?

I have a string, say r"a". I want to replace every r"a" with the string r"\1", but my regex engine does not understand this. I have tried: r"\1" -- crashes (can't match group 1 because there is no group 1) r"\\1" -- crashes (not sure why) Is this a limitation of my (proprietary) regex engine, or is it a general problem? Is there an ...

How to escape & in a POST request in jQuery?

Hi, i have an input element with & in value: <input type="checkbox" value="Biografie, životopisy, osudy, Domácí rock&amp;pop" /> When i try sending it through an ajax request: $.ajax({ type: "POST", url: "/admin/kategorie/add/link.json", data: "id="+id+"&value="+value+"&type="+type, error: function(){alert('Chyba! Rel...

Java backspace escape

I just tested the backspace escape as follows: System.out.println("Hello\b"); I expected to get the output: Hell But it was: "Hello" with a square block anyone knows how java handle this? ...

When do I need to escape metacharectars? (jQuery Selectors)

According to the jQuery docs, I need to escape metacharacters that occur in my selector strings, when they occur as a literal. However, I couldn't find very many specific examples of when and when not to escape selectors. So when and when don't I need to escape metacharacters, when they are to be interpreted as a literal, in: Attribute ...

Java Escaping String for Storage in csv file

If want to store user created strings in a csv file. Is there a preferred library to use for Escaping the string or should I write my own function? ...

PHP: preg_match_all - Couldn't write a working RegEx

Hello, I have for example a string \try Tester234 where I want to find the Word (partially with digits) (RegEx => (\w|\d)) after the \try. But a var_dump($match) outputs that: array 0 => array empty 1 => array empty preg_match_all('/^\\try ((\d|\w)*)/i', "\try Tester", $match); What am I doing wrong? ...

wcf forces chars escaping in response

Hi, All I want to return unescaped html in the WCF response, therefore I need CDATA section to be included in the response all the time. I realized I have no chance with DataContractSerializer. So I have tried to mark my operation with [XmlSerializerFormat] and implement IXmlSerializable in the response class. I see that my serializ...

Automatic reserved word escaping for Hibernate tables and columns

I am trying to use one Hibernate mapping for several different databases: H2, Oracle, MySql. Each database has a different list of reserved words. I would like Hibernate to automatically escape the reserved words. I know I can: use backticks to force escaping (escape everything just to be safe) change all identifiers so they are ce...

PHP filter POST from PayPal IPN?

I have a PayPal IPN PHP file set up which assigns all of the IPN post contents variables to variables. This file is only 'hit' from paypal.com (ie nobody should know it's url). My question is should I take the necessary steps to filter and sanitize the POST data from PayPal or is masking my IPN file name (IPN_082j3f08jasdf.php) enough? ...