escaping

Rails - Escaping HTML using the h() AND excluding specific tags.

Hello! I was wondering, and was as of yet, unable to find any answers online, how to accomplish the following. Let's say I have a string that contains the following: my_string = "Hello, I am a string." (in the preview window I see that this is actually formatting in BOLD and ITALIC instead of showing the "strong" and "i" tags) Now, I...

Python: json.loads chokes on escapes

I have an application that is sending a JSON object (formatted with Prototype) to an ASP server. On the server, the Python 2.6 "json" module tries to loads() the JSON, but it's choking on some combination of backslashes. Observe: >>> s '{"FileExists": true, "Version": "4.3.2.1", "Path": "\\\\host\\dir\\file.exe"}' >>> tmp = json.load...

How do you escape a reserved word in Delphi?

I need to Escape a reserved word to use it as an identifier in Delphi. I thought that was accomplished by using the ampersand "&", but that doesn't seem to be working right. Any other suggestions? ...

Quotes and double quotes always escaped when retrieve from table? How can I fix this?

Hi guys, I'm using the Zend framework here - I've noticed that for some reason the information is automatically escaped when it goes into the database - it doesn't do so on my localhost but it escapes automatically on my host. And when data is retrieved its not unescaped so something like 'Chris O'Donnel' goes in as Christ O\' Donnel and...

Ruby: how to match a double quote in a regexp

I am trying to remove some double quotes (") characters from a text file using a Ruby one liner, with little success. I have tried the following, and some variations, without success. ruby -pe 'gsub(/\"/,"")' < myfile.txt This gives me the following error: -e:1: Invalid argument - < (Errno::EINVAL) I am running Ruby on a Win machi...

Url link encoding within XSLT

I'm trying to link to a SharePoint page from an HTML document produced using an XSL transformation, but it keeps complaining that the link is invalid: <a href="site.aspx?List={5r45d0e2-f7eb-4658-a585-3277gr4327ee}&amp;RootFolderUrl=url&amp;Name=name">My Link</a> Obviously, the link is full of unusual characters, and I'm not too sure h...

Jquery taconite selector with character that needs to be escaped

I'm using the jquery taconite plugin to make an ajax request that will replace a certain element in my page, however the element has an id like "email.subject".. I can select it just fine if I do '$("email\\.subject")', but when I try to use the taconite plugin like this: <taconite> <replaceWith select="#email\\.subject"> ...

Escaping characters in javascript strings

I thought that escaping quote characters in javascript was done by either using the other style of quote "xxx ' yyy" or 'xxx " yyy' or using a backslash to quote them 'xxx \' yyy\' or "xxx \" yyy" but that doesn't seem to work in the problem I am currently working on. The code I want to put in my generated HTML is: ...

How to pass xml text as argument in exec ant task?

We need to call an executable from ant that takes xml as part of the argument. Using exec is easy enough, but one of the arguments includes an xml file. We tried loading the xml file using the loadfile target with striplinebreaks <loadfile property="xmlStuff" srcFile="xmlFile.xml"> <filterchain> <striplinebrea...

Is there a PHP function that can escape regex patterns before they are applied?

Is there a PHP function that can escape regex patterns before they are applied? I am looking along the lines of the C# Regex.Escape function. ...

Escape XML special chars in AJAX

I have an XML document which contains some invalid characters (é for example). Unfortunalty I cannot change the source XML file, and the file must be read through AJAX. How can I escape these characters client side? Much thanks, Steve EDIT: $.ajax({ type: "GET", url: "http://foo.com", dataType: "xml", success: f...

how to escape special characters in jasperreports ?

how to escape special characters in jasperreports ? I want to escape special characters like :- é, â, è, ^, @ in jasper reports, so is there any way we can escape this characters ? ...

Exact string match in vim? (Like 'regex-off' mode in less.)

In vim, I often want to search on a string with finicky characters which need escaping. Is there a way I can turn off the meaning of all special characters, kind of like regex-off mode in less, or fgrep? I am dealing with particularly hairy strings; here's an example: ((N/N)/(N/N))/N Not having to escape any characters to do a search...

jinja2: html escape variables

how do I html-escape dangerous unsanitized input in jinja2? Can I do it inside the template or must it be done in python code? I have a variable that may contain da<ngero>u&s chars. How do I escape it in jinja2 ...

How do I escape all special characters in Access Jet SQL?

I'm trying to change a password with a DDL statement like: CurrentProject.Connection.Execute "ALTER USER barney PASSWORD "[]!@#$%^ oldpassword" Yes, that's a nasty password, but someone tried something like that. Notice the beginning quote of the password is not part of the sql syntax here. I need something like mysql_real_escape_st...

Escape sequence for ? in c++

Hi, I was looking at the escape sequences for characters in strings in c++ and I noticed there is an escape sequence for a question mark. Can someone tell me why this is? It just seems a little odd and I can't figure out what ? does in a string. Thanks. ...

Escaping with this PHP function is unsafe?

Hi, If I escape data with addcslashes($input,chr(0x00) . chr(0x0d) . chr(0x0a) . chr(0x1a) . chr(0x5c) . chr(0x27) . chr(0x22)); would that be enough to stop SQLi? I have all required characters there, so, as long as the $input is UTF-8, there should be no problems with that itself. Of course invalid use of the method or something si...

Why is Swing Parser's handleText not handling nested tags?

I need to transform some HTML text that has nested tags to decorate 'matches' with a css attribute to highlight it (like firefox search). I can't just do a simple replace (think if user searched for "img" for example), so I'm trying to just do the replace within the body text (not on tag attributes). I have a pretty straightforward HTML...

Should a colon character be escaped in TEXT values in iCalendar (rfc2445)?

My understanding from reading the specification (http://www.ietf.org/rfc/rfc2445.txt) is that the ":" character should not be escaped in text values like DESCRIPTION. From the RFC: The "TEXT" property values may also contain special characters that are used to signify delimiters, such as a COMMA character for lists of va...

Escaping a block of text in MikTeX?

I am trying to insert a block of code into MikTeX which contains many reserved characters. Is there any way I can escape the whole block of code so that the conversion engine does not try to evaluate it? I suppose this would only work if the the code had balanced brackets. Is there a way I can convert the block of text so that all i...